<?
/* $Id: example.php,v 1.0 2004/27/11 22:12:25 tobozo Exp $ */
?>
<html>
<head>
<title>Find closest color</title>
</head>
<body><pre>
Code example :
<?
require_once('colorMatrixHTML.class');
$red = 72;
$green = 123;
$blue = 211;
$HTMLcolor = colorMatrix::getClosestRGBLColor($red, $green, $blue);
?>
</pre>
<?
require_once('colorMatrixHTML.class');
$red = 72;
$green = 123;
$blue = 211;
$hex = '#a1b2c3';
$HTMLcolor = colorMatrix::getClosestRGBColor($red, $green, $blue);
echo "<font style='color:rgb($red,$green,$blue);'>This is the original color (red=$red, green=$green, blue=$blue)</font><br>";
echo "<font style='color:$HTMLcolor;'>This is the closest color (html color = $HTMLcolor)</font><br><br>";
$hex = '#a1b2c3';
?><pre>
$HTMLcolor = colorMatrix::getClosestHTMLColor($hex);
</pre><?
$HTMLcolor = colorMatrix::getClosestHTMLColor($hex);
echo "<font style='color:$hex;'>This is the original color (hex=$hex)</font><br>";
echo "<font style='color:$HTMLcolor;'>This is the closest color (html color = $HTMLcolor)</font><br><br>";
?>
</body>
</html>
|