Skip to content

hracik/php-color-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Color converter

Converts color between HEX, RGB and HSL.

Getting Started

These instructions will get you a copy of the project up and running

Installing

Install with Composer

composer require hracik/php-color-converter

Usage

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);

Running the tests

Run

./vendor/bin/phpunit --bootstrap vendor/autoload.php tests

For Windows platforms

./vendor/bin/phpunit.bat --bootstrap vendor/autoload.php tests

Built With

  • PHPUnit - The PHP Testing Framework

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Andrej Lahucky - Initial work - Hracik

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

  • PurpleBooth

About

Converts color between HEX, RGB and HSL.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages