Location: PHPKode > scripts > colour > colour/examples_color.class.php
<?php

include("color.class.php");

$color=new color();

// Set Pantone color name
$color->set_pantone("304 C");

$cmyk=$color->get_cmyk();
echo "CMYK - Cyan:".$cmyk['cyan']." Magenta ".$cmyk['magenta']." Yelow:".$cmyk['yellow']." Black ".$cmyk['cyan']."<br>";

$rgb=$color->get_rgb();
echo "RGB - Red:".$rgb['red']." Green ".$rgb['green']." Blue:".$rgb['blue']."<br>";

$hex=$color->get_hex();
echo "HEX - <b><font color=\"$hex\">$hex</font></b><br><br>";

// Set CMYK color values
$color->set_cmyk("100","57","0","2");

$cmyk=$color->get_cmyk();
echo "CMYK - Cyan:".$cmyk['cyan']." Magenta ".$cmyk['magenta']." Yelow:".$cmyk['yellow']." Black ".$cmyk['cyan']."<br>";

$rgb=$color->get_rgb();
echo "RGB - Red:".$rgb['red']." Green ".$rgb['green']." Blue:".$rgb['blue']."<br>";

$hex=$color->get_hex();
echo "HEX - <b><font color=\"$hex\">$hex</font></b><br><br>";


// Set CMYK color values
$color->set_rgb("255","0","0");

$cmyk=$color->get_cmyk();
echo "CMYK - Cyan:".$cmyk['cyan']." Magenta ".$cmyk['magenta']." Yelow:".$cmyk['yellow']." Black ".$cmyk['cyan']."<br>";

$rgb=$color->get_rgb();
echo "RGB - Red:".$rgb['red']." Green ".$rgb['green']." Blue:".$rgb['blue']."<br>";

$hex=$color->get_hex();
echo "HEX - <b><font color=\"$hex\">$hex</font></b><br><br>";

// Set HEX color values
$color->set_hex("ff00ff");

$cmyk=$color->get_cmyk();
echo "CMYK - Cyan:".$cmyk['cyan']." Magenta ".$cmyk['magenta']." Yelow:".$cmyk['yellow']." Black ".$cmyk['cyan']."<br>";

$rgb=$color->get_rgb();
echo "RGB - Red:".$rgb['red']." Green ".$rgb['green']." Blue:".$rgb['blue']."<br>";

$hex=$color->get_hex();
echo "HEX - <b><font color=\"$hex\">$hex</font></b><br>";


?>
Return current item: colour