Uzyskaj kod koloru z łańcucha
function getColour($seed, $rgbArray = false) {
$hash = md5($seed);
$r = hexdec(substr($hash, 0, 2));
$g = hexdec(substr($hash, 2, 2));
$b = hexdec(substr($hash, 4, 2));
if ($rgbArray) {
return array('R' => $r, 'G' => $g, 'B' => $b);
}
$highR = $r + 10;
$highG = $g + 10;
$highB = $b + 10;
$main = '#' . str_pad(dechex($r), 2, '0', STR_PAD_LEFT)
. str_pad(dechex($g), 2, '0', STR_PAD_LEFT)
. str_pad(dechex($b), 2, '0', STR_PAD_LEFT);
$highlight = '#' . dechex($highR) . dechex($highG) . dechex($highB);
return array('main' => $main, 'highlight' => $highlight);
}
$t = getColour('Assigned');
Thoughtful Tapir