-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
L*a*b* chromatic adaptation #42
Comments
Wow, CSS will include lab and lch color spaces! Nice of them to include detailed descriptions and reference implementations. Changing d3-color to match the specification would be great. |
The current CSS specification for Lab / LCH leaves some legroom to the choice of matrices / precision when transforming sRGB to Lab, but the intent is to have the Lab be relative to the standard D50 white point. In the pull request above, I'm skipping some intermediary steps from the reference implementation and using a single matrix for linear RGB ↔ XYZD50 from the same web page they cite in their code. The output closely matches Matlab's |
Fixed in #46. |
While investigating why d3's
lab()
method gives subtly different results than, for example, Wolfram Alpha, I came to understand d3-color is missing a chromatic adaptation between the D65 (sRGB) and D50 (Lab) illuminants:The process should be: Lab ↔ XYZ (D50) ↔ XYZ(D65) ↔ RGB
I'm not sure how important this adaptation is to the purpose of the library, but it boils down to using the matrices from this page:
The text was updated successfully, but these errors were encountered: