Converts color between HEX, RGB and HSL.
These instructions will get you a copy of the project up and running
Install with Composer
composer require hracik/php-color-converter
use Hracik\ColorConverter;
//$hex in format #ffffff
$hsl = ColorConverter::hex2hsl($hex);
$rgb = ColorConverter::hex2rgb($hex);
//$rgb as array like [0, 99, 255] each value between 0-255
$hex = ColorConverter::rgb2hex($rgb);
$hsl = ColorConverter::rgb2hsl($rgb);
//$hsl as array like [0.542, 1.0, 0.5]
$rgb = ColorConverter::hsl2rgb($hsl);
$hex = ColorConverter::hsl2hex($hsl);
Run
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests
For Windows platforms
./vendor/bin/phpunit.bat --bootstrap vendor/autoload.php tests
- PHPUnit - The PHP Testing Framework
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Andrej Lahucky - Initial work - Hracik
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details.
- PurpleBooth