[csswg-drafts] Back-porting the mixed `<number>` and `<percentage>` color component syntaxes to CSS Color 4 (#8322)

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

== Back-porting the mixed `<number>` and `<percentage>` color component syntaxes to CSS Color 4 ==
This was already proposed and discussed in passing, in the context of a CSS Color 5 issue, but I wanted to break it out into a separate issue to be sure no-one missed it.

Relative Color Syntax is CSS Color 5 allows mixing  `<number>` and `<percentage>`. But currently, this is only allowed for RCS; if you miss out the `from <color>` then you have to use all-numbers or all-percentages for the color components.

Here is a quote from [a WPT test](https://github.com/web-platform-tests/wpt/blob/master/css/css-color/parsing/color-valid-relative-color.html#L97):

```html
    // Testing mixes of number and percentage. (These would not be allowed in the non-relative syntax).
    test_valid_value(`color`, `rgb(from rebeccapurple r 20% 10)`, `rgb(102, 51, 10)`);
    test_valid_value(`color`, `rgb(from rebeccapurple r 10 20%)`, `rgb(102, 10, 51)`);
    test_valid_value(`color`, `rgb(from rebeccapurple 0% 10 10)`, `rgb(0, 10, 10)`);
    test_valid_value(`color`, `rgb(from rgb(20%, 40%, 60%, 80%) r 20% 10)`, `rgb(51, 51, 10)`);
    test_valid_value(`color`, `rgb(from rgb(20%, 40%, 60%, 80%) r 10 20%)`, `rgb(51, 10, 51)`);
    test_valid_value(`color`, `rgb(from rgb(20%, 40%, 60%, 80%) 0% 10 10)`, `rgb(0, 10, 10)`);
```

This seems silly, and so [I said](https://github.com/w3c/csswg-drafts/issues/7900#issuecomment-1317325754):

> Also tempted to back-port the "accept a mixture of <number> and <percentage>" to CSS Color 4. I believe this already has tests in WPT (because people are implementing CSS Color 5 and 4 at the same time).

To be clear, this would affect the modern syntax only, not the legacy syntax. 

Also to be clear, people can get this mixing already, if they really want, simply by _not actually using the origin color_:

`rgb(from black 50% 75 127)`

I am proposing to make those simplifying edits and then to change the relevant portions of WPT tests so that previously invalid combinations get moved over to the valid tests.


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


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

Received on Tuesday, 17 January 2023 19:48:39 UTC