-
Notifications
You must be signed in to change notification settings - Fork 5
Basic usage
Simon Holloway edited this page Nov 29, 2013
·
4 revisions
MrColor is a color manipulation library for PHP.
The library will soon be available on packagist/composer
<?php
use SyHolloway\MrColor\Color;
//Create a new color object with the default value of black
$color1 = Color::create();
//Create a new color object setting the red, green and blue values
$color2 = Color::create(array(
'red' => 200,
'green' => 200,
'blue' => 100
));
//Edit the color properties
$color2->red++;
$color2->hue = 180;
$color2->lightness += 0.2;
/*
* All properties are kept in sync so when hue, lightness, hex ect. change
* red blue and green are updated in real time
*/
$newrgb = array(
'red' => $color2->red,
'green' => $color2->green,
'blue' => $color2->blue
)
?>