从PHP生成渐变颜色

eni*_*eni 3 css php

我想知道如何构建一个函数,它给出颜色代码并显示这种颜色的渐变.例如:

function generate_color(int colorindex)
{  .......
   .......
   Generate 10  pale colors of this color.


}
Run Code Online (Sandbox Code Playgroud)

请帮我

sym*_*ean 5

迈克尔引用的代码相当可怕.但解决方案很简单.如果您只考虑灰度图像,可能会更清楚:

 function create_pallette($start, $end, $entries=10)
 {
    $inc=($start - $end)/($entries-1);
    $out=array(0=>$start);
    for ($x=1; $x<$entries;$x++) {
      $out[$x]=$start+$inc * $x;
    }
    return $out;
 }
Run Code Online (Sandbox Code Playgroud)

仅使用3D矢量(RGB)而不是1D矢量.

C.