Skip to content
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

The two HSV values are not equal before and after the tinyColor conversion #219

Open
DangoSky opened this issue Dec 6, 2020 · 3 comments

Comments

@DangoSky
Copy link

DangoSky commented Dec 6, 2020

I wrote a demo to reproduce this problem.

https://codepen.io/dangosky/pen/JjRGGbZ

@jlove73071
Copy link

RGB has 3 color channels. each channel has 1 byte stored in memory.

HSL/HSV has 3 channels storing the same information. Each channel is a REAL (not integer) number.
If you pass in HSLA and convert to RGB, there will often be rounding that occurs. Converting from HSV to RGB and back will not likely result in the same numbers. Converting to RGB to HSV and back to RGB should produce the same results though, in my experience,

@meakle
Copy link

meakle commented Apr 3, 2023

@DangoSky color.toRgbString() will round the converted value, so the returned value itself may not be accurate.

image

I would suggest not using this library for continuous conversion, as the precision of the return values may have already been rounded.

@meakle
Copy link

meakle commented Apr 3, 2023

I meet same problem, and I try to use other library. This library is not suitable for color conversion.

https://codepen.io/meakle/pen/XWPvEEo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants