Generate persistantly unique colors from a string.

2.0.0 2016-10-09 18:55 UTC


Latest Stable Version Total Downloads Author License Build Status

Generate persistently unique colors from a string.

Like this project? Keep me caffeinated by making a donation.


Install with Composer

composer require phlak/colorizer


// Import Colorizer
use Colorizer;

// Initialize Colorizer
$colorize = new Colorizer\Colorize();

// Generate a hex color code from 'foo'
$hexColor = $colorize->toHex('foo');  // Returns '#a5c4e0'

// Generate a RGB color code from 'bar'
$rgbColor = $colorize->toRGB('bar');  // Returns 'rgb(238, 215, 222)'

Normalizing Colors

You can enforce RGB values to fall within a certain range to prevent colors from being too bright or dark. This is possible by passing minimum and maximum normalization values (0-255) to the Colorize class on initialization:

$colorize = new Colorizer\Colorize(64, 224);

or on an already existing object:

$colorize->normalize(64, 224);


Please report bugs to the GitHub Issue Tracker.


This project is liscensed under the MIT License.