- From: Lea Verou via GitHub <sysbot+gh@w3.org>
- Date: Thu, 04 Apr 2024 14:11:28 +0000
- To: public-css-archive@w3.org
@jyasskin > 1. @ccameron-chromium said in [[css-color-4] Channel clipping breaks author expectations, especially when using 'perceptually uniform' spaces #9449 (comment)](https://github.com/w3c/csswg-drafts/issues/9449#issuecomment-2023984610) that he'd be fine with a gamut-mapping rule of the form "minimize the perceptual difference between the specified and displayed color while preserving hue". That is not testable so making such a statement normative means very little. > He's been opposed to mapping algorithms that strictly preserve lightness since he doesn't think he could apply them to images, but he's fine with a better algorithm than clipping if it can also be applied to images. What I don't yet understand is, does he want this to be the *default* or just *possible*? The use cases he brought to the group were from "partners" who have engineering teams for whom applying a CSS declaration on the root (or whatever other opt-in we come up with) is no big deal. Also, as has been said in the thread many times, the best GMA for CSS is likely not a good GMA for images, since the use cases are different. > (One could imagine looking for a surrounding [contrast-color()](https://drafts.csswg.org/css-color-6/#colorcontrast) call, Please don't link to `contrast-color()` in L6, that’s likely going to change quite a lot. However there *is* a `contrast-color()` MVP in css-color-5 which has WG consensus and is pretty much ready for implementations: https://drafts.csswg.org/css-color-5/#contrast-color (relevant issue: https://github.com/w3c/csswg-drafts/issues/9166 ) > 3. It's hard to figure out an author's intent when presented with a color in isolation. I think what most use cases share in terms of goals is the desire to minimize the difference between the two colors. There are well established algorithms for color difference (the ΔΕ algorithms) that take into account how each component contributes to the perceptual difference between two colors and produce a single number. I think a goal framed around minimizing ΔΕ (for some ΔΕ algorithm) is likely the best default here, with opt-ins that make different tradeoffs. > 5. If we want to be conservative, we could try to ensure the final gamut-mapping algorithm preserves the WCAG contrast the author asked for in (iii). Surprisingly, the author _hasn't_ asked for a specific WCAG score by picking an oklch lightness value. @foolip pointed out to me that none of the WCAG contrast definitions use the same definition of "lightness" as either L*a*b* or OkLCH. So I played around with [jsfiddle.net/mahq9fjL](https://jsfiddle.net/mahq9fjL/) and found that for `oklch(90% 90% 0deg)`, for a lightness difference that, for grey, gives a WCAG 2 7:1 contrast ratio, you can vary the chroma and hue and get contrast ratios anywhere from 6:1 to 8:1. For an ACPA score of -90 against grey, varying chroma and hue can find scores from -83 to -101. Constraining to colors in P3, it seems like lightness changes of about 0.03 fall into the hue-caused imprecision in the WCAG scores. I’m actually surprised the differences you found were this small! Last I checked, I couldn't even use L to reliably pick between white or black text! > 6. If we want to be less conservative, we could mandate that gamut mapping algorithms only change lightness by ∆L, and then authors who want to adjust user-chosen colors into a particular contrast score just need to increase their adjustment by ∆L to be confident it won't be broken by gamut mapping. I don't know what value of ∆L will be acceptable for images, or if it needs to vary depending on the starting lightness level, but the experiments in [bottosson.github.io/posts/gamutclipping](https://bottosson.github.io/posts/gamutclipping/) seem to indicate that _some_ constraint on the change in lightness can work for images. I literally [asked](https://github.com/w3c/csswg-drafts/issues/9449#issuecomment-1967827846) @ccameron-chromium if he would be ok with _precisely_ that and [he said no](https://github.com/w3c/csswg-drafts/issues/9449#issuecomment-1978836522), that he wants the bulk of the gamut mapping operations to be anything goes with only the tiny bit at the end being normative. -- GitHub Notification of comment by LeaVerou Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9449#issuecomment-2037325351 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 4 April 2024 14:11:29 UTC