Re: [csswg-drafts] [css-color-5] Grammar for parsing relative colors? (#7721)

> > The problem lies in that the parameters to rgb() and its ilk are not defined individually, but using {3}. And while I recognize that this simplifies the definitions that require all three parameters to be of the same type, it does sort of relegate the channel keywords to something of an afterthought.
> 
> Forbidding someone from using, say, the `r` value as part of the green channel, is more trouble than it is worth and there could be valid use cases (imagine someone doing custom chromatic adaptation by making each of the channels of `xyz-d65` be a weighted sum of `x`, `y` and `z` for example).

Hmm. I think I was thinking of it more from the perspective of naming the part of grammar in its definition, rather than restricting the use of these keywords elsewhere.

But I do think I am beginning to get a better picture of the design of these keywords: They're not so much part of the grammar as they are defined as part of the concept the grammar represents. As in, "once you have this color, these keywords are defined to represent certain characteristics of it". I think that was the part I was struggling with, and is perhaps the part that needs to be most clarified.

In particular, I get the sense that the [Relative Color Syntax](https://drafts.csswg.org/css-color-5/#relative-colors) section has some circular definitions and/or is conflating the syntactic definitions with the concepts behind them.

Separately (and I don't understand colorspaces enough to know if this is a nonsense question): Does it make sense to define these relative color keywords separately/independently from the function definitions? If you define a color using `rgb()`, can you extract a `w` value from it, for instance?

> > I encountered code that was a little overzealously combining the definitions of hsl() and hwb() (based on definitions in earlier specs)
> 
> The only thing which is the same with those two is the hue channel, which has identical definitions in both. What was the code doing?

https://github.com/servo/rust-cssparser/pull/293

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


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

Received on Monday, 19 September 2022 00:13:12 UTC