rawTemperature2018 static method
Warm-cool per Ou et al.'s "universal model" (2018), fit to psychophysical data from 12 regions worldwide. Kept for comparison.
WC = -0.89 + 0.052 * chroma * [cos(hue - 50°) + 0.16*cos(2*hue - 350°)]
Reference: Ou et al., "Universal Models of Colour Emotion and Colour Harmony", Color Research & Application 43 (2018), Equation A6.
Implementation
static double rawTemperature2018(Hct color) {
final lab = labFromArgb(color.toInt());
final hue = sanitizeDegreesDouble(
math.atan2(lab[2], lab[1]) * 180.0 / math.pi,
);
final chroma = math.sqrt((lab[1] * lab[1]) + (lab[2] * lab[2]));
final radians = math.pi / 180.0;
return -0.89 +
0.052 *
chroma *
(math.cos(sanitizeDegreesDouble(hue - 50.0) * radians) +
0.16 *
math.cos(
sanitizeDegreesDouble(2.0 * hue - 350.0) * radians,
));
}