Re: [csswg-drafts] [css-color-6] It should be possible to specify the contrast algorithm for color-contrast() (#7356)

The CSS Working Group just discussed `specifying the contrast algo for color-contrast()`, and agreed to the following:

* `RESOLVED: Allow color-contrast() to specify the algo and level, by taking an algo function as an arg`

<details><summary>The full IRC log of that discussion</summary>
&lt;TabAtkins> Subtopic: specifying the contrast algo for color-contrast()<br>
&lt;TabAtkins> lea: since there are problems with every contrast algo known right now<br>
&lt;TabAtkins> lea: wcag2 is well known but with big problems<br>
&lt;TabAtkins> lea: theres' a study linked in the issue that shows it has something like 40% false results<br>
&lt;TabAtkins> lea: we suspect the reason in practice people don't realize how bad it is is because the colors you feed in aren't random, they're already "probably readable", so this is a second line of defense<br>
&lt;TabAtkins> lea: but once it's baked into a css algo it'll be used to generate color pairs without author intervention<br>
&lt;TabAtkins> lea: so if it's this bad, we can't use it<br>
&lt;TabAtkins> lea: otoh, ACAG[?] is positioned as a successor, but has issues<br>
&lt;TabAtkins> lea: Patent filed for it, unclear if it's usable<br>
&lt;TabAtkins> lea: weird note about licensing for web-based usages<br>
&lt;chris> qq+<br>
&lt;TabAtkins> lea: and the author has been rather difficult to work with, got a temp ban from w3c<br>
&lt;una> q+<br>
&lt;TabAtkins> lea: there are some other algos, chris probably knows more, they also generally don't produce great results<br>
&lt;chris> s/ACAG[?]/APCA<br>
&lt;TabAtkins> lea: So a) it should be possible to specify the algo specifically, rather than picking a default<br>
&lt;flackr> q+<br>
&lt;TabAtkins> lea: but even if we make it mandatory, that's not a solution, authors will learn an invocation and we won't bea ble to shift away<br>
&lt;TabAtkins> fantasai: So not shipping yet, but we stil lneed to add keywords<br>
&lt;TabAtkins> lea: not keywords, some kinda function since the levels are different fro each algo<br>
&lt;Rossen_> ack chris<br>
&lt;Zakim> chris, you wanted to react to lea<br>
&lt;TabAtkins> chris: re the patent situation<br>
&lt;TabAtkins> chris: At a certain maturity level you can lodge an exclusion<br>
&lt;TabAtkins> chris: In this case the patent was disclosed but not excluded<br>
&lt;TabAtkins> chris: the actual disclosure has some wording about license restrictions<br>
&lt;TabAtkins> chris: the patent policy does not allow such restrictions<br>
&lt;TabAtkins> chris: it needs RAND as well as free<br>
&lt;TabAtkins> chris: w3c patent people say it's unenforcable<br>
&lt;TabAtkins> chris: so currently it seems to be royalty-free<br>
&lt;Rossen_> q<br>
&lt;florian> q-<br>
&lt;TabAtkins> florian: the patent disclosure period has elapsed, and there was no exclusion<br>
&lt;lea> q+<br>
&lt;chris> q+ to talk about levels per algorithm<br>
&lt;TabAtkins> una: agree its 'important to speciy the algo<br>
&lt;Rossen_> ack una<br>
&lt;TabAtkins> una: Wanna be able to use new algos in the future<br>
&lt;lea> q-<br>
&lt;TabAtkins> una: Yesterday we also talked about letting the browser decide the auto algo<br>
&lt;dbaron> +1 to "should be able to specify the algorithm" (pending the details, which are in other issues!)<br>
&lt;TabAtkins> una: If wcag2 is the current default, we want the browser to be able to update to new ones<br>
&lt;TabAtkins> una: I think this can be done if there's no keyword (or auto?)<br>
&lt;TabAtkins> una: and a keyword means the user always wants a specific algo<br>
&lt;TabAtkins> una: seems like best of both worlds for usability and ability to be specific for contrast algo<br>
&lt;TabAtkins> una: tldr, should be able to specify contrast algo but also should be able to say auto<br>
&lt;Rossen_> ack florian<br>
&lt;Rossen_> ack flackr<br>
&lt;TabAtkins> flackr: if the user has told the browser they have a color deficiency, can the UA take that into account and select a contrasting color based on it?<br>
&lt;TabAtkins> chris: people with atypical color vision don't ahve reduced contrast sensitivity<br>
&lt;TabAtkins> chris: with exception of red-on-black<br>
&lt;TabAtkins> chris: where they're actually better<br>
&lt;Rossen_> q?<br>
&lt;Rossen_> ack chris<br>
&lt;Zakim> chris, you wanted to talk about levels per algorithm<br>
&lt;TabAtkins> chris: re the "function instead of keyword", it's because the different algos use different numeric ranges<br>
&lt;TabAtkins> dbaron: responding to una<br>
&lt;Rossen_> ack dbaron<br>
&lt;TabAtkins> dbaron: maybe pushing a little outside this issue<br>
&lt;TabAtkins> dbaron: i am skeptical of anything where we ship something and later change what color is produced<br>
&lt;TabAtkins> dbaron: people will evaluate whether they've succeeded in their design not just by writing a contrast(), but also by looking at it and making sure they like it<br>
&lt;florian> +1<br>
&lt;TabAtkins> dbaron: if we go and change the colors later, people will probably be unhappy and pages will be broken<br>
&lt;TabAtkins> una: this is why i think it should be an option<br>
&lt;florian> q+<br>
&lt;TabAtkins> una: but authors should generally be using a specific algo<br>
&lt;TabAtkins> una: but an option could be to let the browser decide, if they don't care as much about a particular combo<br>
&lt;TabAtkins> dbaron: i think once we ship the feature it'll be hard to change<br>
&lt;Rossen_> ack florian<br>
&lt;TabAtkins> color-contrast(unstable-algo-don't-use(1.0) ...)<br>
&lt;TabAtkins> florian: agree, we'll be dealing with less fuly-informed authors and teams, who will show the result to someone in approval who won't be caring about code, just result, and even if it's well-intended it might look wrong alter<br>
&lt;TabAtkins> florian: even if you told them it could be different that wouldn't matter<br>
&lt;TabAtkins> una: i'm afraid if we ship the current contrast algo people wont' update their code, adn pages will be stuck on bad results<br>
&lt;Rossen_> q<br>
&lt;bkardell_> q+<br>
&lt;TabAtkins> miriam: I agree that's a useful use-case and what I'd expect<br>
&lt;TabAtkins> miriam: I think it would be useful to recommend to authors to put the algo into a custom prop so it's easy to update later<br>
&lt;Rossen_> ack fantasai<br>
&lt;TabAtkins> fantasai: given how broken wcag2 is, we're asking a lot of people to bake wcag2 into their page, and they won't update their code ever<br>
&lt;TabAtkins> fantasai: if wcag2 is the only thing we have to offer and we don't have the ability to auto-upgrade it<br>
&lt;castastrophe> q+<br>
&lt;TabAtkins> fantasai: then even 5 years from now people will be teaching that you use the wcag2 algo<br>
&lt;chris> q+<br>
&lt;TabAtkins> fantasai: seems harmful to the web and we shouldn't be shipping it as a solution<br>
&lt;bkardell_> q-<br>
&lt;TabAtkins> fantasai: if we wanted to go down the auto-updating path and ship now, we could ship a more limited version that only gives white or black<br>
&lt;TabAtkins> fantasai: that's basic, but it solves a useful problem<br>
&lt;TabAtkins> fantasai: text is readable<br>
&lt;TabAtkins> fantasai: but for this issue, i think we do need the ability to choose an algorithm<br>
&lt;TabAtkins> fantasai: not just because we want authors to change what they use over time, but they also might actually want a specific algo, frmo design or legal perspective<br>
&lt;TabAtkins> fantasai: in the future we might have an excellent algo, but the laws in XYZ might require contrast that conforms to wcag2, I want to be able to say I want the color that conforms to awesome-algo and wcag2.<br>
&lt;TabAtkins> fantasai: So not just one algo, but 2+<br>
&lt;chris> q?<br>
&lt;TabAtkins> fantasai: In the case of "most contrasty one", you can only ahve one, but in "reach at least this level" we can offer multiple<br>
&lt;bkardell_> q+<br>
&lt;chris> q-<br>
&lt;TabAtkins> fantasai: I agree that using a function makes most sense so we can put appropriate scale info in<br>
&lt;TabAtkins> fantasai: so for this issue proposal is to add one or more algo functions to color-contrast() arg<br>
&lt;TabAtkins> fantasai: that accept the numeric level<br>
&lt;TabAtkins> fantasai: and this should be one of the prelude args<br>
&lt;TabAtkins> castastrophe: so much +1 to that<br>
&lt;lea> needless to say, +1 to everything fantasai just said<br>
&lt;TabAtkins> castastrophe: from design system perspective, people aren't likely to update this code frequently<br>
&lt;TabAtkins> castastrophe: so having generic name function with a default algo that we can update as we go along...<br>
&lt;TabAtkins> castastrophe: i don't know if we've changed defaults under the feet<br>
&lt;TabAtkins> castastrophe: we've done that a lot in design components, using the bad default for now until we figure it out<br>
&lt;TabAtkins> fantasai: i agree with that, but that's a different issue about the default<br>
&lt;bkardell_> q-<br>
&lt;Rossen_> ack castastrophe<br>
&lt;TabAtkins> fantasai: for the purpose of this discussion it's assumed specified<br>
&lt;una> q?<br>
&lt;una> q+<br>
&lt;TabAtkins> castastrophe: was thinking about generic name<br>
&lt;TabAtkins> fantasai: name is color-contrast(), and you'd say like color-contrast(wcag(...), black, white)<br>
&lt;TabAtkins> una: so this issue is about always requiring a specific color-contrast algo<br>
&lt;TabAtkins> fantasai: for now, we can discuss optionality later<br>
&lt;TabAtkins> una: def +1 on making it possible<br>
&lt;TabAtkins> una: i would like a world where it's not required<br>
&lt;fantasai> default algorithm -> https://github.com/w3c/csswg-drafts/issues/7361<br>
&lt;TabAtkins> una: we'll discuss that later<br>
&lt;Rossen_> ack una<br>
&lt;TabAtkins> chris: we can always relax it later if it's required now<br>
&lt;TabAtkins> fantasai: so proposal is we add to color-contrast() a number of specific-algo functions accepted as one of its arguments<br>
&lt;TabAtkins> dbaron: clarifying - saying the level is optional. does that mean if you don't you get th emost contrasty choice, and if you do you get the first color that meets the level?<br>
&lt;TabAtkins> chris: yes, that's already what the spec says<br>
&lt;TabAtkins> Rossen_: objections<br>
&lt;TabAtkins> lea: what's the reason to get the most contrasty pair? why not just default to a reasonable level?<br>
&lt;dbaron> s/if you don't/if you don't give a level/<br>
&lt;TabAtkins> RESOLVED: Allow color-contrast() to specify the algo and level, by taking an algo function as an arg<br>
&lt;TabAtkins> Rossen_: that's another issue, we'll discuss that later<br>
&lt;TabAtkins> una: what if none of the color values work?<br>
&lt;TabAtkins> chris: If you give a target and you run off the end of the lsit, you'll get either white or black, whichever is better<br>
&lt;dbaron> (what happens if algorithms disagree on whether white or black is higher contrast? :-P)<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7356#issuecomment-1202862867 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 2 August 2022 15:44:25 UTC