Public feed
#893997
private function gen_nick_color($nick)
{
if (isset($this->nick_colors[$nick]))
{
return $this->nick_colors[$nick];
}
$md5 = sha1(strtolower($nick));
$r = hexdec(substr($md5, 0, 2));
$g = hexdec(substr($md5, 6, 2));
$b = hexdec(substr($md5, 12, 2));
if ($r < 0x60) $r += 0x60;
if ($g < 0x60) $g += 0x60;
if ($b < 0x60) $b += 0x60;
$n = hexdec(substr($md5, 10, 1));
if ($n <= 5)
{
$r = min(255, $r * 2);
}
else if ($n >= 6 && $n <= 10)
{
$g = min(255, $g * 2);
}
else if ($n >= 11)
{
$b = min(255, $b * 2);
}
$c = array(floor($r), floor($g), floor($b));
$this->nick_colors[$nick] = $c;
return $c;
}