org_heigl / color
A Library to handle Colors. This includes conversion to and from different spaces including ICC-profiles as well as modifying existing colors
Installs: 2 263
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 1
Open Issues: 4
Requires
- php: ^5.4 || ^7.0
Requires (Dev)
- mockery/mockery: ^0.9.5
- phpunit/phpunit: ^4.8 || ^5.4
This package is auto-updated.
Last update: 2024-11-29 03:58:10 UTC
README
This library helps handling colors and ICC-Profiles in PHP
Installation
Installation is best done using composer like this:
composer require org_heigl/color
Requirements
This library requires at least PHP 5.5 and is tested up to PHP 7.0
Usage
Reading different informations from an ICC-Profile.
use Org_Heigl\Color\Profile as P; $profile = P\Renderer::renderProfile('/path/tp/profile', new P\Profile()); echo $profile->getTable('desc')->getContent() // Outputs the Name of the profile
You can use it as described in this short example. For more examples have a look at the documentation.
// This uses a gras-green and changes it to a lighter variation // for usage as background-color use Org_Heigl\Color as C; $color = C\ColorFactory::createFromRgb(123,234,12); $handler = C\Handler\HandlerFactory::getHslHandler($color); $handler->setLuminance(0.8); echo C\Renderer\RendererFactory::getRgbHexRenderer()->render($handler->getColor()); // Prints #ccfa9e
alternate Example using a CMYK-Color as input and merging it with an RGB-Color to get a new color as HSL-Value
// This uses a dark green as input color and merges it with a light red use Org_Heigl\Color as C $green = C\ColorFactory::createFromCmyk(100, 0, 100, 0); $red = C\ColorFactory::createFromRgb(255, 128, 128); $handler = C\Handler\HandlerFactory::getMergeHandler($green); $handler->merge($red); echo C\Renderer\RendererFactory::getHslRenderer()->render($handler->getColor()); // Prints hsl(h.hh,s.ss,l.ll);
License
This library is licensed unser the MIT-License