I have written a lib for working with colours and stuck trying to calculate Tc(k)
. From what I have read working in the CIE 1931 XYZ
colour space i
Found the Temperature to RGB solution written in JavaScript and converted it into PHP.
clamp($red, 0, 255),
'g' => clamp($green, 0, 255),
'b' => clamp($blue, 0, 255)
];
}
function clamp($x, $min, $max)
{
if ($x < $min)
return $min;
if ($x > $max)
return $max;
return $x;
}
var_dump(colorTemperatureToRGB(7000));