-
Notifications
You must be signed in to change notification settings - Fork 103
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
Black (#000000) and White (#FFFFFF) lose hue and saturation value, even if they're part of the output. #111
Comments
I'll look into it. As you mentioned, RGB conversion will logically cause this. As will CMYK and L_A_B conversion or pretty much any conversion to and from HSV (or HSL or HSB) colorspaces. Internally, Colorpicker tries to preserve any explicitely set colorspace channel values in whatever colorspace is actively used. Sadly this means that ANY modification of non-HSV colorspaces will lose the H and/or S. It's actually quite hard to ensure this that this doesn't happen but it should be possible to trace the culprit down. |
Could colorpicker be made to stick to one colorspace internally even if the user is actively using another colorspace? In the demo I mentioned, for example, the programmer might tell colorpicker to always use HSV internally since its input and output are in HSV. Then, even if the end user picks a Red value, the internal representation remains in HSV colorspace. |
Colorspaces don't all cover the same possible range of colors, therefore it is impossible to map every color possible in the used colorspace to any other specific "internal" colorspace without loss of detail on the used colorspace. This is why Colorpicker switches the internal model dependant on the last used controls' colorspace representation; it's the only way to store the color exactly as the user specified. |
I've tested a bit, but it seems that if you use a colorFormat that uses HSV (i.e. '#hxsxvx'), then nothing gets lost. |
This can be demonstrated on the additional demos page, under "Output Formatting".
Black:
On reopening the colorpicker, the hue and saturation are back to 0. Compare to the same steps except set Value to 1 (or a value close to but greater than 0).
White:
On reopening the colorpicker, the hue is back to 0. Compare to the same steps except set Value to 99 instead of 100, or Saturation to 1 instead of 0.
This behavior makes sense when the output is purely rgb (including hex), because rgb(0,0,0) and rgb(1.0,1.0,1.0) have no hue. But when the output is hsv this does not make sense any more.
The text was updated successfully, but these errors were encountered: