[sport]產生一些色碼當背景用

//文字為黑色,避免全黑,全白,背景儘量淡一些
//黑色 #000000    白色#ffffff

//ca color array
//$ca=array("22","44","66","88","aa","cc","ee"); 
//$ca=array("11","22","33","44","55","66","77","88","99","aa");
$ca=array("66","77","88","99","aa","bb","cc","dd","ee","ff");
//cn   color number-1
$cn=count($ca)-1;

for($i=0;$i<50;$i++)  {
    $c="#";
    for($j=0;$j<3;$j++)  {
        $c .= $ca[rand(0,$cn)];
    }

    $bgcolor_arr[$i]=$c;
    echo  "<span style='background-color:{$c}'>$c</span> ";
}
echo "<br><br>";
foreach ($bgcolor_arr as $k => $v) {
	echo '"'.$v.'",';
}
echo "<br><br>";

 

本篇發表於 程式設計。將永久鏈結加入書籤。