-
Notifications
You must be signed in to change notification settings - Fork 547
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
LCH 🠖 RGB mismatch compared to other libraries #278
Comments
I noticed this as well when converting from RGB to LCH. Input: Output:
Most noticeable is the +5 to the hue, which skews the colour closer to purple |
as far as I understand it. the conversion depends on the white-point.
https://en.wikipedia.org/wiki/CIELAB_color_space#Cylindrical_representation:_CIELCh_or_CIEHLC So you would have to know what white-point each library is using to be able to compare its results. |
It looks like colord uses W3C sample code for making the conversion from RGB → LAB: The W3C draft specifies the D50 whitepoint:
https://www.w3.org/TR/css-color-4/#rgb-to-lab d3-color uses their own algorithm and also uses D50 as the whitepoint: And chroma.js uses D65 here: So this looks to be the reason for the difference |
https://css.land/lch seems to use https://drafts.csswg.org/css-color-4/utilities.js for converting between sRGB and LCH, which document the steps like this:
I do not know what steps chroma.js uses, but it would be interesting to know and hear the reasons for the difference in steps taken. |
Update: chroma.js now allows you to set a Lab illuminant: https://gka.github.io/chroma.js/#chroma-setlabwhitepoint @adrian5 perhaps this helps your issue? |
This library looks wonderfully feature rich, but playing with the demo page I noticed that it produces a different RGB color than other libraries, given LCH input.
Input:
{ l: 59.6, c: 61.3, h: 24.3 }
Output:
#ec5f67
#ec5f67
#ec5f67
#ec5f67
#ef6066
Is this due to differences in the transformation stages, or maybe LCHab vs LCHuv? I have very limited knowledge of this topic, so I couldn't say.
The text was updated successfully, but these errors were encountered: