Re: [csswg-drafts] [css-values-5] Express which keywords are valid in calculations in syntax definitions (#11505)

I do not know if you intentionally left out infering which color component keywords are valid *outside calculations*. 

The relative color syntax is *partially* encoded in color function definitions: it includes `[from <color>]?`, but not the corresponding component keywords, which seems unfortunate.

A *fully* encoded example for `rgb()` could be:

```
rgb() = <legacy-rgb-syntax> | <modern-rgb-syntax> | <relative-rgb-syntax>

<legacy-rgb-syntax> = rgb([ [ <percentage>#{3} | <number>#{3} ] , <alpha-value>? ])
<modern-rgb-syntax> = rgb([ <rgb-component>{3} [ / [ <alpha-value> | none ] ]? ])
<relative-rgb-syntax> = rgb([
  from <color>
  [ <rgb-component> | <rgb-component-keyword> ]{3}
  [ / [ <alpha-value> | none | <rgb-component-keyword> ] ]?
])
<rgb-component> = <number> | <percentage> | none
<rgb-component-keyword> = r | g | b | alpha
```

This is more consequential, but perhaps useful for readers.

This does not address the issue *in calculations* though, whereas a prose defining that *any numeric value in a color function can be replaced with a corresponding component keyword*, addresses both concerns, which is more straightforward.

I do not know if the authors of CSS Colors 5 already considered this.

-- 
GitHub Notification of comment by cdoublev
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11505#issuecomment-2755621477 using your GitHub account


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

Received on Wednesday, 26 March 2025 20:01:27 UTC