使用加密哈希并剪切您不需要的字节:
@H_301_9@function getColor($num) {
$hash = md5('color' . $num); // modify 'color' to get a different palette
return array(
hexdec(substr($hash,2)),// r
hexdec(substr($hash,2,// g
hexdec(substr($hash,4,2))); //b
}
结果(code to generate it)对于数字0-20看起来像这样: