Skip to content

[css-color] gray() function produces a warm, D50 white #4622

Closed
@svgeesus

Description

@svgeesus

The gray() function is defined in terms of CIE Lab, with the a and b chromatic axes set to 0. In the spec currently, Lab is defined relative to a D50 whitepoint, in accordance with typical (print) industry practice and for compatibility with most spectrophotometer default settings.

In consequence, gray(100) will give an Lab value of 100 0 0

D50 = [100, 0, 0];  // Lab 100 0 0
Array(3) [ 100, 0, 0 ]
D50_XYZ = Lab_to_XYZ(D50);  //Convert to CIE XYZ
Array(3) [ 0.96422, 1, 0.82521 ]
D50_XYZ_D65 = D50_to_D65(D50_XYZ); // Bradford chromatic adaptation transform from D50 to D65
Array(3) [ 0.9504700036079999, 1.0000000624270002, 1.088830036462 ]
D50_RGB = gam_sRGB(XYZ_to_lin_sRGB(D50_XYZ_D65));  // convert to sRGB
Array(3) [ 0.9999999809955643, 1.000000034987241, 1.0000000100781432 ]

this gives an sRGB value of
rgb(99.99999809955643% 100.0000034987241% 100.00000100781432%)
which will be clipped on g and b to 100%
but is a warm white.

Converting the D65-adapted white back to Lab:

wrong = XYZ_to_Lab(D50_XYZ_D65);  // convert unadapted XYZ to Lab
Array(3) [ 100.00000241384396, -2.388102770071454, -19.362232628332656 ]

The difference is certainly noticeable (ΔE 2000 is 13.64).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions