$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
));

相关文章:

  • 2021-12-25
  • 2021-07-08
  • 2021-12-19
  • 2021-12-19
  • 2022-02-10
  • 2022-12-23
猜你喜欢
  • 2021-07-20
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案