-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Fix jzczhz check for achromatic colors #629
base: main
Are you sure you want to change the base?
Conversation
The default ε (0.00001) calculated for jzczhz is to low for achromatic colors. The highest az or bz value for an achromatic color is -0.00023625807422922307 for color(rec2100-pq 1 1 1). The ColorSpace class has been modified to allow setting ε when constructing a ColorSpace and the ε for jzczhz has been set to 0.0002363. This new ε ensures that all achromatic colors up to the brightest white in req2100-pq have a null hue when converted to jzczhz. However, with the new ε there are some non-achromatic colors near black in rec2100-pq that will be considered to be achromatic when converted to jzczhz.
✅ Deploy Preview for colorjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Yeah, that means you lose those colors, unfortunately. This kind of thing crops up with a number of color spaces, especially ones that allow you to adjust the viewing environment and assuming the eye is not fully adapted, such as CAM16, ZCAM, HCT, RLAB, etc. In such spaces, the achromatic colors, those with zero chroma, don't necessarily align with what one would traditionally consider neutral in sRGB due to the influence of the adapting luminance and background luminance. I think the question becomes is achromatic what is considered neutral in the given space (with the given viewing environment and when chroma is zero) or is it strictly what we would consider achromatic in a given RGB space? In Jzabz's case, chroma doesn't get anywhere near as big as it does in CAM16 and HCT near white, so you can probably get away with giving it a more relaxed threshold (like is done in this PR) at the expense of some color. Maybe the small loss of colors won't matter? In spaces like CAM16 and HCT, such an approach simply can't work. You need something more complicated as the traditional achromatic line is more dynamic in these spaces. I'm not really sure what is preferable. I experimented with such things earlier, and at least in my own color library, I decided to make "achromatic" relative to the space, and when chroma is near zero in those spaces, it is considered achromatic. I think I preferred not losing colors if it could be helped. I at least think that with JzCzhz, if this is the direction we want to go, the impact might not be too large. |
See also #613 (comment) |
So it is now clear that ε should be chosen to encompass the narrow range of values close to the central axis where the hue angle is ill-conditioned and replaced with In many spaces (but not all) that is also where achromatic colors converted from some RGB space where R=G=B fall. For the spaces where that is not true, that is because of color appearance; the eye is not fully adapted and so neutrals gradually diverge from the central axis as the neutral gets brighter. But the hue angle is not ill-conditioned and the ε should not be made artificially large so as to encompass these colors. |
1 similar comment
So it is now clear that ε should be chosen to encompass the narrow range of values close to the central axis where the hue angle is ill-conditioned and replaced with In many spaces (but not all) that is also where achromatic colors converted from some RGB space where R=G=B fall. For the spaces where that is not true, that is because of color appearance; the eye is not fully adapted and so neutrals gradually diverge from the central axis as the neutral gets brighter. But the hue angle is not ill-conditioned and the ε should not be made artificially large so as to encompass these colors. |
The default
ε
(0.00001) calculated forjzczhz
is to low for achromatic colors. The highestaz
orbz
value for an achromatic color is-0.00023625807422922307
for color(rec2100-pq 1 1 1).The
ColorSpace
class has been modified to allow settingε
when constructing aColorSpace
and theε
forjzczhz
has been set to0.0002363
.This new
ε
ensures that all achromatic colors up to the brightest white inreq2100-pq
have a null hue when converted tojzczhz
.However, with the new
ε
there are some non-achromatic colors near black inrec2100-pq
that will be considered to be achromatic when converted tojzczhz
. I think this is ok but I wanted to point them out.I rounded the
ε
, I can change it to the exact number if that's a more appropriate value.