-
Notifications
You must be signed in to change notification settings - Fork 40
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
LAB incorrectly converted #43
Comments
Lab and xyz color spaces are not well tested, and thus marked as experimental so far. If you have actually will known conversions that should work and have any reference to the correct color math I would be very happy to take a look at revisiting these. A PR with failing color conversions would be very helpful as well |
I don't know anything about the LAB colorspace, but there must be something fishy. Conversions from rgb to lab and back again don't result in the same color, unless you dial up the epsilon way up: oneColor('rebeccapurple').lab().rgb().equals(oneColor('rebeccapurple'), .2) // false
oneColor('rebeccapurple').lab().rgb().equals(oneColor('rebeccapurple'), .3) // true |
@Munter: For the example above I just used some online converters like https://www.nixsensor.com/free-color-converter/. |
I wouldn't be surprised that it's completely broken. Both XYZ and LAB were me just implementing it from a maths page without having any form of conversion examples I could plug in for testing. There's also the problem that you have to choose a reference whitepoint (https://github.com/One-com/one-color/blob/master/lib/XYZ.js#L14-L21) and all examples I could find differ greatly. So I simply had no idea how to make a correct implementation and where to find any resource that would be considered correct |
LAB colour: 60, -28, -32
RGB (converted): 0, 160, 200
Output:
The calculated RGB value of 93, 93, 93 results in different colour (visually) and
also doesn't match the expected RGB value of 0, 160, 200.
The text was updated successfully, but these errors were encountered: