public function contrastColors($backgroundColor)
 {
     $background = Color::stringToRgb24($backgroundColor);
     $this->string = preg_replace_callback('/(?<!\\$)((?:\\$[\\$])*)(\\$[0-9a-f][^\\$]{0,2})/iu', function ($matches) use($background) {
         $color = Color::stringToRgb24($matches[2]);
         $color = Color::contrast($color, $background);
         $color = Color::rgb24ToRgb12($color);
         $color = Color::rgb12ToString($color);
         return $matches[1] . '$' . $color;
     }, $this->string);
     return $this;
 }