niclashedam / color
This package is abandoned and no longer maintained.
No replacement package was suggested.
Color conversion, color likeliness and color names
1.0.2
2018-01-31 12:49 UTC
Requires
- php: >=5.4.0
Requires (Dev)
This package is auto-updated.
Last update: 2020-04-16 12:12:25 UTC
README
This tool providers methods to convert from RGB and CMYK, to RGB, CMYK and HEX. Also this tool can calculate the relative difference between two given colors. This cool can also provide you with the name of the color you provided.
Installation
Install it using composer
composer require niclashedam/color
Usage
Just include it and instantiate the Color class.
use NiclasHedam/Color;
$black = Color::fromRGB(0, 0, 0);
$white = Color::fromCMYK(0, 0, 0, 0);
$black->differenceBetween($white); //100
$black->name(); // "Black"
$black->toHEX(); // "#000000"
$orange = Color::fromRGB(255, 165, 0);
$orange->differenceBetween($white); //61.2255
See exampes/example.php for more examples
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
License
Released under the MIT license