Re: [csswg-drafts] [css-color-5] Clarify serialization of color-mix() (#6206)

The CSS Working Group just discussed `[css-color-5] Clarify serialization of color-mix()`, and agreed to the following:

* `RESOLVED: color-mix() returns color() for sRGB mixes`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Topic: [css-color-5] Clarify serialization of color-mix()<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/6206<br>
&lt;bradk> I just shared a rendering that I **think** is what fantasai was proposing<br>
&lt;bradk> Shared in WebEx<br>
&lt;fantasai> chris: agreement in general, remaining issue is should things like hsl come out as themselves, come out as rgb, or use the color() function which retains more precision<br>
&lt;bradk> Ok<br>
&lt;fantasai> chris: Emilio said it would be harder to ship, but could see the value of it, so not sure where we are on that<br>
&lt;fantasai> emilio: That's still my opinion<br>
&lt;fantasai> emilio: slight preference to serialize as input color<br>
&lt;fantasai> chris: I can see arguments both ways<br>
&lt;fantasai> chris: I have a slight preference for serializing as color()<br>
&lt;fantasai> jensimmons: any visual difference in the result?<br>
&lt;fantasai> chris: there could be, but very slight<br>
&lt;fantasai> chris: if only 8-bit, and do mix of a mix, lose some precision and could result in banding<br>
&lt;fantasai> emilio: that's also an implementation detail<br>
&lt;fantasai> emilio: no reason why colors can't be more precise than 8-bit<br>
&lt;fantasai> chris: that's not what implementations do<br>
&lt;fantasai> chris: spec mandates are higher precision for newer color spaces<br>
&lt;fantasai> chris: of course can implement at higher precision<br>
&lt;fantasai> chris: but concerned we'll get some degradataion<br>
&lt;fantasai> jensimmons: screens are getting better, and color precision going better, seems we should go with higher precision<br>
&lt;astearns> ack fantasai<br>
&lt;chris> qq+<br>
&lt;emilio> fantasai: can be confusing to give two hsl colors and get a different color<br>
&lt;emilio> ... from the precision argument I don't see why we won't just encourage implementations to have more precision<br>
&lt;astearns> ack chris<br>
&lt;Zakim> chris, you wanted to react to fantasai<br>
&lt;emilio> ... I don't understand why you'd have different precision on color() vs rgb()<br>
&lt;fantasai> chris: not just giving two colors, you specified color space to mix in and you get back in that color space<br>
&lt;fantasai> chris: shouldn't be that surprising<br>
&lt;emilio> q+<br>
&lt;fantasai> chris: wrt precision, implementations have been stuck on 8-bit for a long time<br>
&lt;fantasai> chris: but we've also written for other color spaces need 10-bit or 12-bit, or 16-bit for xyz<br>
&lt;fantasai> chris: so implementations going into those color spaces need more precision<br>
&lt;fantasai> chris: we did say that if you're giving a 0255 value in rgb you can get ?? when you serialize<br>
&lt;astearns> s/??/decimal places/<br>
&lt;fantasai> chris: but saying hope that everyone upgrades from 8-bit... harder than requiring upgrade for new stuff<br>
&lt;fantasai> emilio: I agree with fantasai<br>
&lt;fantasai> emilio: we use 8-bit colors for space-efficiency<br>
&lt;fantasai> emilio: so you can store an RGB color in one integer<br>
&lt;fantasai> emilio: but if we need more precision for htis feature, we can increase<br>
&lt;fantasai> emilio: if we implement high-precision sRGB we would do it both for color() and rgb()<br>
&lt;fantasai> emilio: there's no point in having two different representations for the same color space<br>
&lt;fantasai> astearns: just having higher precision for rgb() and color() wouldn't be sufficient, because color() can give you color spaces that are higher precision<br>
&lt;fantasai> fantasai: if I mix 2 rgb colors in xyz space, do I get a color in rgb or xyz space?<br>
&lt;fantasai> chris: xyz space<br>
&lt;fantasai> faceless: if I mix 2 rgb colors in rgb space, I get rgb space back right?<br>
&lt;fantasai> chris: yes<br>
&lt;fantasai> s/faceless/fantasai/<br>
&lt;fantasai> [missed]<br>
&lt;fantasai> astearns: so that you can plug that function into a nother property and not lose precision<br>
&lt;emilio> q+<br>
&lt;astearns> ack emilio<br>
&lt;fantasai> fantasai: if color(rgb) has a particular precision, no reason for rgb() to have different precision<br>
&lt;fantasai> emilio: ...<br>
&lt;fantasai> emilio: given you need to return a color in ?? color space, I don't think it we serialize as color() or rgb()<br>
&lt;lea> q?<br>
&lt;fantasai> emilio: maybe color() is more consistent with other colorspace outputs?<br>
&lt;lea> q+<br>
&lt;lea> q-<br>
&lt;fantasai> emilio: I'd be fine serializing as color() if easier for e.g. WebKit, for us it would be the same<br>
&lt;fantasai> astearns: I'm hearing a lot of, yeah, either way is fine I gues<br>
&lt;fantasai> astearns: so should we pick serializing as a color() function?<br>
&lt;fantasai> chris:  you're going to get color() function anyway in any of the other color spaces<br>
&lt;fantasai> chris: if you just happen to pick srgb, need to pick what to do there<br>
&lt;fantasai> chris: imho more consistent to say get a color() function back<br>
&lt;fantasai> astearns: so proposed resolution is to serialize as a color() function<br>
&lt;chris> +1<br>
&lt;fantasai> lea: It's not always [missed]<br>
&lt;fantasai> lea: it's not always possible to serialize everything as color() function, there are functions only available in their own function e.g. lab() lch()<br>
&lt;fantasai> chris: That's true, but you won't see them in rgb() form either<br>
&lt;emilio> q+<br>
&lt;fantasai> lea: so does proposed resolution affect only mixing in rgb()?<br>
&lt;fantasai> lea: because right now that is the only color available both in functional notation and a color() function, and these are distinct color formats<br>
&lt;fantasai> lea: color() function has 10-bit and I think it can go beyond the 0-1 range<br>
&lt;fantasai> lea: I'm not sure if browsers want to use 10-bit format every time someone mixes in sRGB<br>
&lt;fantasai> lea: want to get clarity if this resolution is only about sRGB or about every color space ... which is not even possible<br>
&lt;fantasai> chris: If you choose to mix in sRGB then you'll get in sRGB color space<br>
&lt;fantasai> lea: so interpolation token in sRGB, then ?? interchangeable?<br>
&lt;fantasai> lea: does the syntax allow both?<br>
&lt;astearns> s/??/interpolation token/<br>
&lt;fantasai> lea: You specify which color space you interpolate is "in &lt;colorspace>", in gradients or color-mix() or whatever<br>
&lt;fantasai> lea: does that mean that "in rgb" is same as "in sRGB" ?<br>
&lt;fantasai> chris: you can't say "in rgb"<br>
&lt;fantasai> chris: we don't have a color space called "rgb"<br>
&lt;fantasai> lea: are you sure?<br>
&lt;fantasai> chris: yes<br>
&lt;fantasai> -> https://www.w3.org/TR/css-color-4/<br>
&lt;astearns> ack emilio<br>
&lt;fantasai> emilio: is there any good reason why lab colors can't be specified in color() notation?<br>
&lt;fantasai> chris: because color() started out as predefined rgb spaces<br>
&lt;fantasai> chris: it's a lot shorter for lab/lch to have their own functions<br>
&lt;fantasai> chris: we do have an open issue about throwing everything into color() function<br>
&lt;fantasai> chris: but that would just take existing syntax and make it longer<br>
&lt;fantasai> emilio: benefit is that color-mix() would have consistent output<br>
&lt;fantasai> jensimmons: want to get through these issues so can start shipping<br>
&lt;fantasai> astearns: proposed resolution is that we serialize as a color() function for color-mix that is being mixed in rgb<br>
&lt;fantasai> lea: no rgb, only sRGB, so makes sense to return color()<br>
&lt;fantasai> astearns: any objections to this resolution?<br>
&lt;fantasai> RESOLVED: color-mix() returns color() for sRGB mixes<br>
&lt;chris> q+<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6206#issuecomment-1156709070 using your GitHub account


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

Received on Wednesday, 15 June 2022 16:51:17 UTC