Helps you to convert between the various ways to define a color in CSS.
Assuming you've got a string resembling a color, just call the fromString
method to get a color object back.
$color = Color::fromString('#ff0000');
The hex representation is not the only support schema:
$color = Color::fromString('red');
$color = Color::fromString('rgb(255, 0, 0)');
$color = Color::fromString('hsl(0, 100%, 50%)');
Once you have a color object you can get a HEX representation like this:
echo $color->toHex();