| 
<?php
/**
 * This is an example on using Color to get similar
 * colors based on a supplied hex or rgb color.
 */
 
 $hsv = Color::hex2hsv("#00CCFF");
 //$hsv = Color::rgb2hsv(0, 204, 255);
 
 for ($i = 0; $i < 5; $i++) {
 $rS = mt_rand(0, 100);
 $rV = mt_rand(0, 100);
 
 $bg = "#".Color::hsv2hex($hsv['h'], $rS, $rV);
 //$rgb = Color::hsv2rgb($hsv['h'], $rS, $rV);
 //$bg = "rgb(".$rgb['r'].", ".$rgb['g'].", ".$rgb['b'].")"
 echo "<div style=\"width:100px;height:100px;background-color:".$bg.";\"> </div>\n";
 }
 
 /**
 * You can do the same but for random hues keeping the same by
 * keeping the supplied saturation and value, random saturation
 * by keeping the hue and value, and this will also work using
 * the HSL methods, if you prefer to work with those values.
 */
 ?>
 |