Page 1 of 1

Generate random colors

Posted: Thu Aug 15, 2013 10:36 pm
by mister_v
Question,

is there a special function to get a random color.

Re: Generate random colors

Posted: Thu Aug 15, 2013 10:59 pm
by chris
I don't know of a special function,
but this is a function I use.

function random_color()
{
$r=rand(128,255);
$g=rand(128,255);
$b=rand(128,255);
$color=dechex($r).dechex($g).dechex($b);
return "#".$color;
}