Re: [csswg-drafts] [css-color-6] color-contrast() should distinguish foreground and background (#7359)

The CSS Working Group just discussed `syntax`, and agreed to the following:

* `RESOLVED: Keywords undefined`
* `RESOLVED: Whatever keywords for foreground/background whatever they are are required`
* `RESOLVED: No keyword ahead of algorithm list`

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> subtopic: syntax<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/7359<br>
&lt;fantasai> Suggestion is color-contrast([over|under] &lt;color> &lt;contrast-algo>#, &lt;color>#)<br>
&lt;fantasai> Suggestion is color-contrast([over|under] &lt;color> &lt;contrast-algo>+, &lt;color>#)<br>
&lt;emilio> emilio: why a +<br>
&lt;emilio> fantasai: because they're space-separated<br>
&lt;emilio> una: example w/ colors?<br>
&lt;fantasai> color-contrast(over white wcag2(AA), blue, red, green)<br>
&lt;emilio> astearns: which of blue, red, green looks best over white<br>
&lt;emilio> una: I read white as foreground<br>
&lt;emilio> TabAtkins: proposition first because of gradients<br>
&lt;emilio> una: here I expect location + color value<br>
&lt;emilio> fantasai: we intended to read not as a param but a proposition<br>
&lt;emilio> bramus: why not background/foreground rather than over/under?<br>
&lt;emilio> astearns: that also has the same issue<br>
&lt;emilio> fantasai: we could do that<br>
&lt;emilio> una: I can see where it's coming from but I don't know...<br>
&lt;emilio> chris: not sure it has the same ambiguity<br>
&lt;dbaron> this is why I like color-contrast(white over [blue red green], wcag2(AA))<br>
&lt;emilio> lea: can be icons too right?<br>
&lt;emilio> chris: the algorithm is only about text<br>
&lt;emilio> +1 to dbaron<br>
&lt;smfr> i suggest color-contrast(blue, red, green over white using wcag2(AA))<br>
&lt;lea> +1 to fantasai<br>
&lt;emilio> fantasai: we generally put arbitrary long lists at the end<br>
&lt;emilio> una: I'd make contrast algorithm first<br>
&lt;emilio> ... so wcag2, white over blue, green, red<br>
&lt;emilio> TabAtkins: the algorithm could be typed first<br>
&lt;emilio> fantasai: everything before the first comma can be reordered<br>
&lt;emilio> q+<br>
&lt;una> so you could write: `color-contrast(wcag(AA) white over, red, blue, green)`<br>
&lt;emilio> chris: algo can specified against the target, what if you don't have a target contrast?<br>
&lt;una> s/wcag(AA)/wcag2(AA)<br>
&lt;lea> Could we maybe use a keyword before &lt;contrast-algo>+ ? E.g. using &lt;contrast-algo>+? color-contrast(using wcag(aa) ...)<br>
&lt;fantasai> color-contrast(over white wcag(), red, blue green)<br>
&lt;fantasai> color-contrast(over white wcag(), red, blue, green)<br>
&lt;fantasai> or<br>
&lt;fantasai> color-contrast(over white wcag(max), red, blue, green)<br>
&lt;TabAtkins> not `white over`, that would be invalid<br>
&lt;chris> s/wcag(/wcag2(/g<br>
&lt;TabAtkins> specifically because the order you put it in reverses the meaning<br>
&lt;emilio> una: over before the value is hard to read<br>
&lt;astearns> q+<br>
&lt;emilio> dbaron: I think the bracketed list<br>
&lt;TabAtkins> (`over white` and `white over` read as exactly opposite things)<br>
&lt;dbaron> (because they are opposite things!)<br>
&lt;emilio> dbaron: I think the bracketed list was nice but some people don't like that<br>
&lt;astearns> ack emilio<br>
&lt;emilio> fantasai: I think it should parallel gradients<br>
&lt;emilio> lea: also color-mix()<br>
&lt;fantasai> emilio: given confusion about ordering of stuff, can we choose some fixed order?<br>
&lt;fantasai> emilio: if you can reorder this stuff, we are getting confused<br>
&lt;fantasai> TabAtkins: preposition and color have a fixed order<br>
&lt;fantasai> TabAtkins: but algorithms can be moved around<br>
&lt;fantasai> emilio: why do we want to specify multiple algorithms?<br>
&lt;fantasai> T<br>
&lt;fantasai> TabAtkins: example was, if tomorrow someone comes up with the best contrast algo that works perfectly<br>
&lt;fantasai> TabAtkins: but you also need to satisfy WCAG2 for legal reasons<br>
&lt;fantasai> TabAtkins: you will need to specify two algorithms<br>
&lt;fantasai> chris: 2 algos or multiple?<br>
&lt;una> q+<br>
&lt;fantasai> TabAtkins: 1 or more<br>
&lt;fantasai> TabAtkins: you have to pass all the thresholds<br>
&lt;fantasai> TabAtkins: if they disagree on white or black, we prioritize the first specified algo<br>
&lt;fantasai> una: Wouldn't that give us the same problem with color list last?<br>
&lt;fantasai> fantasai: they're not comma-separated, and you will likely only have one or two<br>
&lt;fantasai> una: could space-separate color list<br>
&lt;bramus> q+<br>
&lt;fantasai> TabAtkins: that would prevent us from adding any parameters to the list, which I don't think we want to do<br>
&lt;una> q-<br>
&lt;astearns> I think I’d prefer `white background` and `white foreground` meaning the color is in that slot<br>
&lt;emilio> astearns: I'm not happy with the proposition, I'd rather have a name<br>
&lt;emilio> ... because it's not misinterpretable<br>
&lt;astearns> s/name/noun phrase/<br>
&lt;bramus> q-<br>
&lt;emilio> fantasai: do we want to go for the full word of just fg/bg?<br>
&lt;bramus> had same concern as astearns<br>
&lt;emilio> una: don't mind that<br>
&lt;lea> not abbreviations please!<br>
&lt;emilio> ... I think it's more readable because color is first<br>
&lt;emilio> bramus: background / foreground is clear<br>
&lt;emilio> clearer to me*<br>
&lt;bkardell_> color-contrast(black foreground wcag(), red, blue, yellow) ?<br>
&lt;emilio> una: if we're having foreground/background what about if you have a border or so?<br>
&lt;bkardell_> is that the suggestion?<br>
&lt;emilio> fantasai: I think you pick your contrast algorithm and pick something<br>
&lt;astearns> q?<br>
&lt;emilio> usually it's not equal amounts of colors<br>
&lt;astearns> ack astearns<br>
&lt;lea> q+<br>
&lt;emilio> so that's what you'd use as background<br>
&lt;fantasai> s/usually/fantasai: usually/<br>
&lt;astearns> ack lea<br>
&lt;fantasai> s/so that/fantasai: so that/<br>
&lt;emilio> lea: given most contrast algos don't distinguish bg/fg, could we have a default?<br>
&lt;emilio> ... so that we don't need to specify?<br>
&lt;emilio> chris: so the first one can be one of them?<br>
&lt;emilio> TabAtkins: what about the algo that does care?<br>
&lt;emilio> ... why not make it gramatically required? Some algos don't care numerically but<br>
&lt;chris> wht nt uz abrvnz<br>
&lt;emilio> lea: also can we not do bg/fg (abbreviations)?<br>
&lt;dbaron> dbaron: why not make it grammatically required (just for the algorithms that require it)?<br>
&lt;emilio> ... also can we have a keyword before the algorithm so it's easier to read?<br>
&lt;emilio> TabAtkins: we usually don't do that unless needed for disambiguation<br>
&lt;emilio> fantasai: as long as it doesn't prevent reordering<br>
&lt;emilio> TabAtkins: proposal is a keyword to separate the algos from the rest of the stuff, like put the keyword "using" in front or so<br>
&lt;emilio> fantasai: we don't need it so I don't think we should add it<br>
&lt;emilio> TabAtkins: agreed<br>
&lt;bramus> `color-contrast(&lt;color> [background|foreground] using &lt;contrast-algo>+, &lt;color>#)` then?<br>
&lt;una> +1<br>
&lt;emilio> dbaron: what I was suggesting is to require foreground / background only when using an algorithm that needs it, otherwise optional<br>
&lt;emilio> lea: that's what I meant<br>
&lt;emilio> TabAtkins: so it'd be grammatically invalid to not provide it?<br>
&lt;emilio> dbaron: yes<br>
&lt;florian> q+<br>
&lt;lea> q+<br>
&lt;TabAtkins> color-contrast([ [ &lt;color> [background|foreground] ] &amp;&amp;  &lt;contrast-algo>+ ], &lt;color>#)`<br>
&lt;emilio> una: related to the following question, auto would always require it<br>
&lt;astearns> ack florian<br>
&lt;emilio> florian: some algos require foreground/background, are there other things?<br>
&lt;emilio> chris: not so far<br>
&lt;emilio> ... there's a proposal to add a third color<br>
&lt;emilio> florian: e.g. to get a numerical value of wcag you don't need font-size, but AA/AAA does<br>
&lt;emilio> ... does that become an input?<br>
&lt;emilio> chris: that's a good question and I think background/foreground is reasonably special<br>
&lt;bkardell_> q+<br>
&lt;emilio> florian: I suspect font-size is quite special too?<br>
&lt;emilio> TabAtkins: you can specify the level as well<br>
&lt;emilio> florian: if you know the font-size<br>
&lt;astearns> ack lea<br>
&lt;emilio> fantasai: since the algorithm takes params we could communicate there<br>
&lt;emilio> lea: that'd make the grammar harder to define that conditional-requirement<br>
&lt;chris> s/third color/third color which is the surround<br>
&lt;emilio> TabAtkins: we'd define it in prose<br>
&lt;emilio> TabAtkins: a bit annoying<br>
&lt;emilio> lea: if we use a default we don't have that problem<br>
&lt;emilio> TabAtkins: yeah but that means that people will forget and get confusing answers<br>
&lt;emilio> lea: maybe mandatory everywhere?<br>
&lt;emilio> TabAtkins: yeah<br>
&lt;emilio> fantasai: I think that'd be fine<br>
&lt;astearns> ack dbaron<br>
&lt;Zakim> dbaron, you wanted to disagree about mandatory everywhere<br>
&lt;emilio> dbaron: I think right now there's only one algo that needs it and is still in flux<br>
&lt;lea> +1 to TabAtkins<br>
&lt;emilio> TabAtkins: I think intuitively, the fact that a lot of algos don't use it is clear that they are garbage, because changing fg and bg significantly changes the perception of contrast<br>
&lt;dbaron> ok, makes sense<br>
&lt;emilio> lea: can we resolve about making bg/fg mandatory?<br>
&lt;astearns> ack bkardell_<br>
&lt;chris> q?<br>
&lt;emilio> bkardell_: lots of the examples colors are just color names<br>
&lt;emilio> ... part of the reason we're doing it at runtime is that you might not have known inputs<br>
&lt;emilio> ... I think the complex case is when you don't have a single color background<br>
&lt;emilio> ... e.g. if you look at the screen what the color name should be?<br>
&lt;emilio> TabAtkins: nobody has put down an algorithm to do that easily<br>
&lt;emilio> bkardell_: I think I disagree<br>
&lt;una> real example, say a button: `color-contrast(lightblue background using wcag2(AA), royalblue, navy, darkblue)`<br>
&lt;astearns> ack fantasai<br>
&lt;Zakim> fantasai, you wanted to say I'm less happy about typing "background" every time<br>
&lt;emilio> TabAtkins: in any case it's a much more complex problem<br>
&lt;lea> una: `using` was rejected<br>
&lt;emilio> fantasai: I'm happy to make things mandatory, but I'm against adding more boilerplate<br>
&lt;emilio> TabAtkins: that's why I was going for fg/bg<br>
&lt;emilio> lea: over/under aren't that much timing<br>
&lt;emilio> typing*<br>
&lt;emilio> TabAtkins: let's clear<br>
&lt;emilio> florian: front/back?<br>
&lt;TabAtkins> s/let's/less/<br>
&lt;emilio> fantasai: that'd work for me<br>
&lt;emilio> una: issue isn't the naming, was the position<br>
&lt;emilio> astearns: proposed resolution is that the first part of the syntax is color with front/back, applying to that color<br>
&lt;una> `color-contrast(lightblue back wcag2(AA), royalblue, navy, darkblue)`<br>
&lt;dbaron> do we want to consider fore/back rather than front/back?<br>
&lt;emilio> fantasai: as long as they're reorderable?<br>
&lt;TabAtkins> color-contrast( [ &lt;color> &amp;&amp; [front | back]? &amp;&amp; &lt;algo>? ], &lt;color># )<br>
&lt;smfr> q+<br>
&lt;astearns> ack smfr<br>
&lt;lea> TabAtkins: &lt;algo>+, not ><br>
&lt;una> dbaron -- I think that `fore` might be more confusing<br>
&lt;emilio> smfr: I think having the fore/back not applying to the chosen colors<br>
&lt;TabAtkins> yes, right, typo on my part<br>
&lt;lea> s/not >/not ?/<br>
&lt;emilio> ... logically I'd think "the color I wanna choose is the front color"<br>
&lt;emilio> astearns: so you'd like the modifier in the color list?<br>
&lt;emilio> florian: we had the same problem with gradient direction, to top left, or from top left?<br>
&lt;emilio> smfr: I kinda prefer under/over but we rejected that so...<br>
&lt;dbaron> I told you smfr wanted prepositions :-)<br>
&lt;emilio> TabAtkins: curious about why you think over/under apply to a different thing than front/back<br>
&lt;lea> yeah, I also liked that over/under read more like natural language :/<br>
&lt;emilio> smfr: because it's like writing an english sentence, over &lt;foo> I can remember<br>
&lt;emilio> una: that's why I preferred using too<br>
&lt;fantasai> 1. over/under<br>
&lt;TabAtkins> color-contrast{start:&lt;color>, position:[front|back], choices: &lt;color>+ }<br>
&lt;fantasai> 2. front/back<br>
&lt;dbaron> IMO, "white front" is natural language but "front white" is not.<br>
&lt;fantasai> 3. something else<br>
&lt;florian> 2<br>
&lt;emilio> lea: what were arguments against over under again?<br>
&lt;emilio> chris: confusing order<br>
&lt;emilio> una: you could reorder the first three values<br>
&lt;emilio> fantasai: we wouldn't allow to reorder that<br>
&lt;smfr> i like ‘over|under &lt;color>’<br>
&lt;emilio> +1 smfr<br>
&lt;emilio> fantasai: in gradients we do the same<br>
&lt;lea> +1 smfr<br>
&lt;una> 2<br>
&lt;lea> 1<br>
&lt;bramus> 2<br>
&lt;TabAtkins> 2<br>
&lt;emilio> 1<br>
&lt;fantasai> 1<br>
&lt;astearns> 2<br>
&lt;chris> 2<br>
&lt;miriam> 1<br>
&lt;smfr> 1<br>
&lt;dbaron> abstain<br>
&lt;bkardell_> abstain<br>
&lt;emeyer> abstain<br>
&lt;dholbert> abstain<br>
&lt;emilio> una: core issue is do we want to make sure it's required?<br>
&lt;dbaron> (BTW, with my [] suggestion there's an only-over option where you could write "green over [red white blue]" or "[red white blue] over green".)<br>
&lt;emilio> lea: we concluded it should be required<br>
&lt;emilio> astearns: no consensus<br>
&lt;emilio> TabAtkins: proposal to keep keywords undefined<br>
&lt;emilio> ... poll authors then come back<br>
&lt;dbaron> (6 votes for #2, 5 votes for #1, 4 abstain... since some people voted with /me and weren't logged)<br>
&lt;emilio> RESOLVED: Keywords undefined<br>
&lt;emilio> RESOLVED: Whatever keywords for foreground/background whatever they are are required<br>
&lt;emilio> RESOLVED: No keyword ahead of algorithm list<br>
&lt;emilio> lol<br>
&lt;emilio> TabAtkins: next is comma separation between color list and the rest<br>
&lt;emilio> chris: if I have `over white, green, red, blue` it looks confusing<br>
&lt;emilio> chris: I don't think it makes sense<br>
&lt;bkardell_> fantasai: I had some lag, but yes - what smfr said :)<br>
&lt;astearns> q?<br>
&lt;emilio> chris: that'd look awful<br>
&lt;emilio> TabAtkins: it'd have the keyword before<br>
&lt;emilio> fantasai: agree it's a problem<br>
&lt;emilio> dbaron: same<br>
&lt;emilio> florian: not sure what's better<br>
&lt;TabAtkins> precedence for / is that it's weaker than commas when mixed<br>
&lt;TabAtkins> we have several properties using that<br>
&lt;emilio> lea: right, alternatives are not better<br>
&lt;emilio> astearns: proposal to punt<br>
&lt;emilio> ... (until keywords are decided)<br>
&lt;smfr> +1 to lea<br>
&lt;emilio> lea: right now color-contrast sounds like it returns a contrast, not a color<br>
&lt;dbaron> I like contrasting-color()<br>
&lt;fantasai> contrast-color()<br>
&lt;emilio> ... can we change the name? color-contrasting / contrasting-color?<br>
&lt;emilio> fantasai: I don't like adding ing<br>
&lt;emilio> lea: I think contrast-color works fine<br>
&lt;emilio> una: I like it<br>
&lt;miriam> +1<br>
&lt;emilio> astearns: objections?<br>
&lt;ydaniv> +1<br>
&lt;emilio> chris: I think we had them and then we harmonized with color-*<br>
&lt;emilio> ... but agree it's better the other way<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7359#issuecomment-1203072807 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 18:27:28 UTC