rawTemperature2004 static method
Warm-cool per Ou, Woodcock and Wright (2004), in CIELAB — the model Material Color Utilities used. Kept for comparison with newer models.
WC = -0.5 + 0.02 * chroma^1.07 * cos(hue - 50°)
Return value has these properties:
- Values below 0 are cool, above 0 are warm.
- Lower bound: -0.52 - (chroma ^ 1.07 / 20). Lab* chroma is infinite. Assuming max of 130 chroma, -9.66.
- Upper bound: -0.52 + (chroma ^ 1.07 / 20). Lab* chroma is infinite. Assuming max of 130 chroma, 8.61.
Implementation
static double rawTemperature2004(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 temperature =
-0.5 +
0.02 *
math.pow(chroma, 1.07) *
math.cos(sanitizeDegreesDouble(hue - 50.0) * math.pi / 180.0);
return temperature;
}