[csswg-drafts] [css-color-5] Commas in color-mix()? (#6066)

LeaVerou has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color-5] Commas in color-mix()? ==
Since various UAs are currently implementing, it's imperative that we finalize the syntax of `color-mix()` ASAP.

I've done a fair bit of editing and clearing up of that section recently, and the current grammar looks like this (note that the adjusters have been removed per editor resolution): 

```
color-mix( in <<colorspace>> && [ [ <<color>> && [ <<percentage>> ]? ] <<color>> ])
```

Valid usage examples per this grammar:
```css
color-mix(in lch red 20% white)
color-mix(in lch 20% red white)
color-mix(red 20% white in lch)
color-mix(20% red white in lch)
```

Invalid usage examples:
```css
color-mix(red in lch 20% white)
color-mix(red 20% in lch white)
color-mix(in lch red white 20%)
```

In previous versions of `color-mix()`, there were commas to separate the color space argument from the colors. After #6050 we resolved to remove that comma. However, since a comma is a "stronger" separator than a space, if we left the comma between colors, it would look as if the color space argument only applies to one of them:

```css
color-mix(in lch red 20%, white)
```

So we removed that comma as well.
While I would strongly object to having a comma only to separate the colors but not the color space from the colors, I think the previous all-comma syntax was actually more readable:

```css
color-mix(in lch, red 20%, white)
/* vs */
color-mix(in lch red 20% white)
```

OTOH this syntax allows for more flexibility in ordering the arguments.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6066 using your GitHub account


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

Received on Tuesday, 2 March 2021 20:16:37 UTC