Re: [csswg-drafts] [css-color-4] HTML needs an html-compatible, hex serialization of 8 bit/component sRGB colors (#10550)

> It's mostly that how to invoke it from HTML is a bit ambiguous, but if the way I did it in [whatwg/html#10481](https://github.com/whatwg/html/pull/10481) works for everyone I'm okay.

I agree that how it's invoked from HTML is too ambiguous.

It would have been nice to have a full algorithm for converting a well-defined "CSS color" data structure into a string, with a named _htmlCompatible_ argument. I can understand if culturally that is not how the CSSWG does serialization though. That is, apparently there is no "CSS color" data structure but instead a `<color>` grammar concept, and it's traditional to give serialization rules as a series of "This applies to this case" sections and "If"s within those sections, instead of one algorithm you could correspond directly with the implementation.

To bridge these worlds, I think the minimum we'd need would be a well-defined linkable `<dfn>` for "HTML-compatible serialization is requested". I think a named parameter _htmlCompatible_ doesn't make sense given that we don't have an actual serialization algorithm `<dfn>`, so I'd suggest modifying https://drafts.csswg.org/css-color/#HTML-compatible-serialization-of-srgb step 5 from

```
5. HTMLCompatible serialization is requested
```

to

```
5. <dfn export for="color serialization">HTML-compatible serialization is requested</dfn>
```

and then we can update the HTML side to say something like `with <a href="...">HTML-compatible serialization requested</a>`.

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


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

Received on Friday, 16 August 2024 05:43:09 UTC