Skip to content
Simon Holloway edited this page Nov 29, 2013 · 4 revisions

MrColor

MrColor is a color manipulation library for PHP.

The library will soon be available on packagist/composer

Basic Functionality

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

?>

Clone this wiki locally