I want to know how to build a function that give the code of an color and display a gradient of this color. For example:
function generate_color(int colorindex)
{ .......
.......
Generate 10 pale colors of this color.
}
Please help me
The code Michael references is rather scary. But the solution is straightforward. It may be clearer if you consider simply a grey scale image:
function create_pallette($start, $end, $entries=10)
{
$inc=($start - $end)/($entries-1);
$out=array(0=>$start);
for ($x=1; $x<$entries;$x++) {
$out[$x]=$start+$inc * $x;
}
return $out;
}
Only using a 3D vector (RGB) instead of a 1D vector.
C.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With