ortic / color-converter
color converter
Installs: 2 742
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
Requires (Dev)
- apigen/apigen: 2.8.0
- friendsofphp/php-cs-fixer: ^2.3
- nette/nette: ~2.1.3
- phpunit/phpunit: ~6.1
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2024-12-11 16:14:41 UTC
README
Helps you to convert between the various ways to define a color in CSS.
Examples
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();