This code generate a simple colortable - not a very acurate one (it would be good to define fade of color - more fading)
<?php
set_time_limit(200);
$width = 360; $height = 18; $offset = -60; $w2deg = $width/360;
$h2byte = $height/255;
$byte2deg = 255/360;
$im = imagecreatetruecolor($width,$height);
for ($x = 0; $x < $width; $x ++){
$x_pos = $x/$w2deg;
$rgb_pos[0] = sin(deg2rad($x_pos) - deg2rad($offset + 0));
$rgb_pos[1] = sin(deg2rad($x_pos) - deg2rad($offset + 120));
$rgb_pos[2] = sin(deg2rad($x_pos) - deg2rad($offset + 240));
$rgb_col[0] = 127 + 127 * $rgb_pos[0];
$rgb_col[1] = 127 + 127 * $rgb_pos[1];
$rgb_col[2] = 127 + 127 * $rgb_pos[2];
for ($y = 0; $y < $height; $y ++){
$y_pos = -255 + ($y/$h2byte) * 2;
$rgb_out[0] = $rgb_col[0] - $y_pos;
$rgb_out[1] = $rgb_col[1] - $y_pos;
$rgb_out[2] = $rgb_col[2] - $y_pos;
foreach($rgb_out as $key => $col){
if ($col > 255){
$rgb_out[$key] = 255;
} else if ($col < 0){
$rgb_out[$key] = 0;
}
}
$col = imagecolorallocate($im,$rgb_out[0],$rgb_out[1],$rgb_out[2]);
imagesetpixel($im,$x,$y,$col);
}
}
imagejpeg($im,'colortable.jpg');
echo '<img src="colortable.jpg">';
?>