Ну можно так попробовать: $s = 51;
for($b=0;$b<=255;$b+=$s)
{
for($g=0;$g<=255;$g+=$s)
{
for($r=0;$r<=255;$r+=$s)
{
$rr = dechex($r) ? dechex($r) : '00';
$gg = dechex($g) ? dechex($g) : '00';
$bb = dechex($b) ? dechex($b) : '00';
$rr = strlen($rr)>1 ? $rr : '0'.$rr;
$gg = strlen($gg)>1 ? $gg : '0'.$gg;
$bb = strlen($bb)>1 ? $bb : '0'.$bb;
$color_text_arr[] = array('#'.$rr.$gg.$bb,'','',$r,$g,$b);
}
}
} правда каша получается.. можно вручную еще: function gethexcolors($r,$g,$b)
{
$rr = dechex($r) ? dechex($r) : '00';
$gg = dechex($g) ? dechex($g) : '00';
$bb = dechex($b) ? dechex($b) : '00';
$rr = strlen($rr)>1 ? $rr : '0'.$rr;
$gg = strlen($gg)>1 ? $gg : '0'.$gg;
$bb = strlen($bb)>1 ? $bb : '0'.$bb;
return array('#'.$rr.$gg.$bb,'','',$r,$g,$b);
}
...
$color_text_arr[] = gethexcolors(255,0,0);
$color_text_arr[] = gethexcolors(0,255,0);
$color_text_arr[] = gethexcolors(0,0,255);
... или так: function getrgbcolors($c)
{
$c = str_replace('#','',$c);
$r = hexdec(substr($c,0,2));
$g = hexdec(substr($c,2,2));
$b = hexdec(substr($c,4,2));
return array('#'.$c,'','',$r,$g,$b);
}
...
$color_text_arr[] = getrgbcolors('#FF0000');
$color_text_arr[] = getrgbcolors('#00FF00');
$color_text_arr[] = getrgbcolors('#0000FF');
...