Here's something I did before ... adapt at will ...
I did it this way so that I could easily boil it down to a subgroup of colours for clients to choose from.
$reds = array("00", "33", "66", "99", "CC", "FF");
$greens = array("00", "33", "66", "99", "CC", "FF");
$blues = array("00", "33", "66", "99", "CC", "FF");
$n = 0;
function col_table($r, $g, $b){
global $n, $reds, $greens, $blues;
$c = "#".$reds[$r].$greens[$g].$blues[$b];
return "<table border=\"1\" cellspacing=\"1\" cellpadding=\"1\">
<tr><td bgcolor=\"".$c."\"><img src=\"shim.gif\" width=\"100\" height=\"25\"></tr>
<tr><td align=\"center\">".($n++)." - ".$c."</td></tr>
</table>";
}
?>
<html>
<head>
<title>Colours</title>
</head>
<body>
<h4>Colours</h4>
<?php
for($r = 0; $r < count($reds); $r++){
for($b = 0; $b < count($blues); $b++){
echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"1\"><tr>";
for($g = 0; $g < count($greens); $g++){
echo "<td>".col_table($r, $g, $b)."</td>";
}
echo "</tr></table>";
}
}
?>
</body>
</html>