标签:
$start_color = array(255, 220, 220);
$end_color = array(255, 80, 80);
$n = count($data);
$colors = array();
for ($i=0; $i<$n;$i++) {
$a = $start_color[0] + round(($end_color[0]-$start_color[0])/$n*$i);
$b = $start_color[1] + round(($end_color[1]-$start_color[1])/$n*$i);
$c = $start_color[2] + round(($end_color[2]-$start_color[2])/$n*$i);
$colors[] = array(
$a, $b, $c
);
}
foreach($colors as &$v){
$v = ‘#‘.dechex($v[0]).dechex($v[1]).dechex($v[2]);
}
unset($v);
$this->ajax_response(AJAX_SUCCESS, array(
‘color‘ => $colors
));
标签:
原文地址:http://www.cnblogs.com/yangjing1314/p/4180110.html