PHP Classes

Color Tools: Convert colors between different color models

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 126 All time: 9,360 This week: 125Up
Version License PHP version Categories
colortools 1.0.0BSD License5PHP 5, Graphics


This class can convert colors between different color models.

It can take a color parameter as a value in several color models or as a name and converts it any of the color models it supports.

Current it supports color models in RGB hexadecimal, RGB, HSL, HSB, WebSafe, CMY, CMYK, GRAYSCALE, an array of individual byte values or an integer value.

The names of supported colors are read from a text file.

Picture of Christian Vigh
  Performance   Level  
Name: Christian Vigh <contact>
Classes: 32 packages by
Country: France France
Age: 57
All time rank: 13810 in France France
Week rank: 8 Up1 in France France Up
Innovation award
Innovation award
Nominee: 20x

Winner: 3x



        This example shows the conversion some color values into different colorimetric


require_once ( 'Colors.phpclass' ) ;

    if (
php_sapi_name ( ) != 'cli' )
"<pre>" ;

$test_colors = array
) ;

    foreach (
$test_colors as $test_color )
"Color to test : $test_color\n" ;
$color = new Color ( $test_color ) ;
"Color value in different colorimetric models :" ;
"\t" . str_replace ( "\n", "\n\t", print_r ( $color -> ToArray ( ), true ) ) . "\n" ;

  Files folder image Files  
File Role Description
Accessible without login Plain text file ColorNames.txt Data Documentation
Plain text file Colors.phpclass Class Class source
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,360
This week:125Up