protected function toRGB_helper($comp, $temp1, $temp2)
{
if ($comp < 0) {
$comp += 1.0;
} elseif ($comp > 1) {
$comp -= 1.0;
}
if (6 * $comp < 1) {
return $temp1 + ($temp2 - $temp1) * 6 * $comp;
}
if (2 * $comp < 1) {
return $temp2;
}
if (3 * $comp < 2) {
return $temp1 + ($temp2 - $temp1) * (2 / 3 - $comp) * 6;
}
return $temp1;
}