W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2021

Re: [csswg-drafts] [css-color-4] What serialization should be used when using color(lab ...) syntax to specify a lab color? (#5825)

From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
Date: Wed, 20 Jan 2021 17:31:20 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-763811221-1611163879-sysbot+gh@w3.org>
The CSS Working Group just discussed `[css-color-4] What serialization should be used when using color(lab ...) syntax to specify a lab color?`, and agreed to the following:

* `RESOLVED: All new color functions serialize to themselves`
* `RESOLVED: Make the first param in the color function, the color space, required`
* `RESOLVED: Have the minimum precision raised to 10 bits`

<details><summary>The full IRC log of that discussion</summary>
&lt;dael> Topic: [css-color-4] What serialization should be used when using color(lab ...) syntax to specify a lab color?<br>
&lt;dael> github: https://github.com/w3c/csswg-drafts/issues/5825<br>
&lt;dael> chris: I added some comments before the call to clarify the options. two questions, what to do for lab and lch and what do for extended precesion<br>
&lt;dael> chris: Spec says if you use lab and lch lch serializes to lab. But if you do color (lab) it serielizes to color. Suggested is all three serialize to lab. I'm willing but wanted feedback to if it's an improvement<br>
&lt;dael> leaverou: On one hand have the rule values serialize to shortest form. Might be helpful for authors if number of formats returned is fewer than ones spec.<br>
&lt;TabAtkins> We shouldn't change the specified function like this - color() should remain color()<br>
&lt;dael> leaverou: I can see arguments for serializing anything that doesn't need backwards compat as color<br>
&lt;dael> astearns: TabAtkins mentioned something on IRC. I believe color emains color and it's only when serialized with a bare lch or lab<br>
&lt;dael> chris: correct<br>
&lt;chris> Tab, not a proposal<br>
&lt;dael> astearns: I can see argument for shortest that if your color happens to have a lab we could serialize to that<br>
&lt;dael> TabAtkins: Confused. First post on thread asks for that. Color with lab color space to serialize to lab function<br>
&lt;dael> TabAtkins: My assumption is lab should be used when refer to color of lab space<br>
&lt;dael> chris: I hadn't read as meaning that. I read as unclear and said spec says what to do. Then it drifted to should we harmonize<br>
&lt;dael> TabAtkins: WE shoudln't change function in a major way. They should get back out what they put in. Color function has a lot more functionality than individual color functions. Would be strange to lose that. In TypedOM it would serialize to form w/o fallbacks<br>
&lt;dael> chris: Agree. If you look at my A and B options I don't propose do away. A is continue as is. B is serialize as color(lab)<br>
&lt;dael> chris: Clearer?<br>
&lt;dael> TabAtkins: Yes<br>
&lt;dael> TabAtkins: Taking that opinion we shouldn't do B because unexpected. I think maybe not A b/c I find it weird<br>
&lt;dael> chris: When discussed previously seems to be what people want.<br>
&lt;dael> TabAtkins: That's true<br>
&lt;argyle> i like option B as well<br>
&lt;dael> plinss: I agree with TabAtkins it's strange if functions changed. If we get to world with typed om where it serliazes as the same function the author created. Will make a world of hurt if functions change, esp if inconsistent<br>
&lt;leaverou> leaverou: hsl() also serializes as rgb(), so lch serializing as lab is the same<br>
&lt;dael> astearns: argyle you mentioned you like changing in IRC?<br>
&lt;TabAtkins> Note that the TypedOM will give trivial conversions to whatever function form you want.<br>
&lt;dael> argyle: I like it. I am acknlowedging hsl serializes to rgb. It is the common space. Most common is where tried to serialize. I like in option b you can write in either syntax and get the superset. You get the higher order. It seems like it upgrades colors not downgrade or transfer.<br>
&lt;bkardell_> of the two I like B better too, I think - but it's really hard to say without actually using it and living with it for a while :-p<br>
&lt;dael> chris: I see a comment the typed om gives color conversion functions. That's not clear to me. I thought that was case but I think I see it gives a null string. Discussion on twitter it should be separate spec.<br>
&lt;dael> chris: I believe in future there will be color conversion functions, though.<br>
&lt;dael> chris: That's broader. I could type hsl and get lab. That's much broader.<br>
&lt;TabAtkins> That Twitter discussion is not reflective of the current spec or my continued intention, fwiw.<br>
&lt;dael> leaverou: Even though typed om helps b/c authors don't parse manually, they still have to handle different formats b/c closely tied. If lab serializes as color(lab) it's unclear to me what typed om class will corrispond. serialization or specified?<br>
&lt;dael> TabAtkins: typed om reifies to the class function it would serialize to. spec you get what you put in and computed it's rules for conversion<br>
&lt;dael> TabAtkins: Another reason not to change into color is class corrispondant to color is more difficult to work with than lab or lch class. If people using anything else would prefer to give easiest to work with.<br>
&lt;fremy> What TabAtkins just said makes a lot of sense to me<br>
&lt;dael> leaverou: The more different classes and author could expect they need to handle. If they don't know color thye have to handle out<br>
&lt;dael> TabAtkins: Can convert to any form they want<br>
&lt;dael> astearns: And if they return color they would still need to deal with first param with all the variations<br>
&lt;dael> chris: Hearing arguments on both sides but no clear consensus.<br>
&lt;dael> smfr: Can you summarize?<br>
&lt;astearns> options: https://github.com/w3c/csswg-drafts/issues/5825#issuecomment-763722847<br>
&lt;dael> chris: The ones in GH. Option A is serialize lab and lch with shortest form which is lab.<br>
&lt;dael> chris: Option B i slbal and lch as color(lab)<br>
&lt;TabAtkins> I was worried about that because Sam proposed it in the original post. ^_^<br>
&lt;dael> chris: TabAtkins was an option c that serializes color(labl) as lab. I only see objections to that.<br>
&lt;TabAtkins> s/was an option/was worred about an option/<br>
&lt;dael> smfr: Have to consider along with serliazation of rgba and srgb. If you look at comment from 3 days ago from Sam he suggests [reads] and lab is odd one out<br>
&lt;dael> smfr: One of the considerations is if you used color for srgb you want to round trip precision.<br>
&lt;dael> chris: Agree in general. color 3 required round to 8 bits. Currently min is 8 bits on both. Happy to increase for color which might make sense. I don't know how much existing code exists elsewhere but none for color form.<br>
&lt;dael> chris: It's always been 0 to 1 so you had precision<br>
&lt;dael> leaverou: If this is higher precision we could consider opt in to other handling<br>
&lt;TabAtkins> My preferred option: serialize lab() to lab(), lch() to lch(), and color(anything) to color(). I'd accept serializing lch() to lab() if necessary, but would prefer to avoid that.<br>
&lt;dael> smfr: One approach would be consider rgh/hsl as legacy and all newer colors serialize with color function<br>
&lt;dael> chris: I can see that as clear<br>
&lt;dael> leaverou: TabAtkins would you argue for changing how hsl serializes?<br>
&lt;dael> TabAtkins: Long past impossible at this point<br>
&lt;dael> TabAtkins: In an ideal world yes, but the compat is out of our hands<br>
&lt;dael> chris: I quite like smfr suggestion. Color rgb serialzes as itself. Therefore lab serializes as color(lab).<br>
&lt;dael> smfr: That falls out. Can see it's annoying for authors<br>
&lt;dael> chris: That's the case in both suggestions. We could change that<br>
&lt;dael> TabAtkins: Only reaon lch serializes to lab is analogy?<br>
&lt;dael> chris: Yes<br>
&lt;dael> smfr: My thought was color function is used to describe the color space and therefore lab and lch are lumpped together. Maybe not great for serialization<br>
&lt;dael> chris: Little legacy, but ongoing impl. Time to change it is now. In 6 months it's too late to change<br>
&lt;dael> TabAtkins: b/c you came in later, I'm moderatly against normalizing to color function because typed om form is a lot more complicated than individual color functions. I would prefer to give the simplier forms if they put them in.<br>
&lt;dael> smfr: Reasonable<br>
&lt;TabAtkins> Omitting the srgb keyword is stadnard "shortest form serialization" stuff, I'm fine with that.<br>
&lt;dael> chris: Since talking about sRGB. The first param is the color space and it defaults to srgb. Two ways to default it. If code is looking at this in serialized forms maybe it's cleaner if it always has an explicit color space. I can argue either way. Shortest serializable or explicit color space<br>
&lt;dael> smfr: Question, if you spec rgba with % which means >8 bit. If that serializes do you maintain precision?<br>
&lt;TabAtkins> Proposal: the sRGB functions all serialize to rgb() (partially legacy, and partially consistency). All other functions serialize to themselves.<br>
&lt;dael> chris: Currently, in color 4 they are no longer int. You can do 137.5 and it's supposed to go to highest possible with a min of 8 bits. Most impl seems ot truncate<br>
&lt;leaverou> TabAtkins: hwb() too?<br>
&lt;dael> smfr: IN WK we use color function to trigger higher precision storage.<br>
&lt;leaverou> TabAtkins: it's an sRGB function, but no legacy implications<br>
&lt;dael> chris: Lots of int precision on the web. I've read people worry about blowing up dom if it's bigger<br>
&lt;TabAtkins> leaverou: Yes, that's the "partially consistency" I mentioned. ^_^<br>
&lt;dael> astearns: TabAtkins has a proposal to have all legacy rgb serialize to rgb and all new serliaze to themselves. Sounds like people are okay with new functions serialize to themselves<br>
&lt;dael> chris: That would amount to option A.<br>
&lt;dael> astearns: Option A except lch serializes to lch<br>
&lt;TabAtkins> But I'm also fine with just "the current legacy functions serialize to rgb(), everything else to itself"<br>
&lt;dael> chris: Okay<br>
&lt;dael> leaverou: If we do srgb to itself it also makes sense to keep lab as itself. It's same thing, really<br>
&lt;dael> chris: Right<br>
&lt;dael> astearns: One person I haven't heard from in a bit is plinss. Would you be okay with this?<br>
&lt;dael> plinss: That's what I argued for. I don't believe functions should change to other functions<br>
&lt;argyle> 👍🏻<br>
&lt;dael> astearns: Prop: All new color functions serialize to themselves<br>
&lt;dael> RESOLVED: All new color functions serialize to themselves<br>
&lt;TabAtkins> color(srgb 1 0 0) should seiralize to color(1 0 0), per shortest-serialization<br>
&lt;dael> chris: Follow up on that. If I say color(srgb) it's same as color(rgb) if i just give rgb. Should they both go to the same form and if so which?<br>
&lt;dael> astearns: TabAtkins says shortest omitting defaults<br>
&lt;tantek> regrets+<br>
&lt;bkardell_> +1 lea<br>
&lt;dael> leaverou: Not sure it's good to have this form without a color space<br>
&lt;fantasai> +1 lea<br>
&lt;dael> chris: I see both arguments. Strong opinions?<br>
&lt;argyle> +1 lea<br>
&lt;dael> smfr: I would prefer srgb as explicit<br>
&lt;TabAtkins> I'd be fine with removing the optionality of the keyword<br>
&lt;dael> plinss: We're talking about the color function optionally losing srgb?<br>
&lt;dael> chris: Making it mandatory<br>
&lt;dael> plinss: When it serializes out you don't have it<br>
&lt;dael> chris: That's one option. We're talking if you want srgb you have to say so<br>
&lt;dael> leaverou: And I see agreement for that in irc<br>
&lt;florian> +1<br>
&lt;dael> plinss: Gotcha. no strong opinion<br>
&lt;dael> chris: I think it's consistent with your argument plinss<br>
&lt;dael> plinss: It's fine. If color space is optional in function I'm fine if it serializes without, but also fine with it not optional<br>
&lt;dael> leaverou: Can make optional in the future. If we start optional we cna't change<br>
&lt;dael> chris: I'm fine removing the optionality<br>
&lt;JaseW> What’s the reason Zakim pinged me?<br>
&lt;dael> astearns: Make the first param in the color funciton, the color space, required<br>
&lt;dael> RESOLVED: Make the first param in the color function, the color space, required<br>
&lt;dael> chris: I can edit this in<br>
&lt;dael> astearns: Something about precision?<br>
&lt;TabAtkins> Just clarifying - does the first resolution apply to hwb() serializing as itself?<br>
&lt;dael> chris: Yes, if you use srgb you expect higher precision. Min is 8 bits right now. I'd like to increase. P3 min is 10 bits per component. COuld make same<br>
&lt;dael> astearns: Prop: Hvae the minimum precision raised to 10 bits<br>
&lt;dael> RESOLVED: Have the minimum precision raised to 10 bits<br>
&lt;dael> chris: hwb is same as hsl where it comes out as rgb or rgba<br>
&lt;TabAtkins> I'm fine either way fwiw<br>
&lt;TabAtkins> non-sRGB functions<br>
&lt;dael> astearns: Resolution about all color functions is ammended to different way of expressing rgb?<br>
&lt;dael> chris: I see hwb as same as hsl<br>
&lt;dael> astearns: Amended resoltuion is now non-rgb color functions serialize to themselves<br>
&lt;leaverou> s/I see hwb as same as hsl/I see hwb as similar to hsl/<br>
&lt;dael> chris: Yes<br>
&lt;dael> astearns: Is that first part of issue or all covered?<br>
&lt;dael> chris: Covered that. I think I'm good<br>
&lt;dael> leaverou: If color srgb has higher precision and difference between that and srgb is maintained can the colors opt into better interpolation? Right now we have backwards compat but doing it in lch is far better. If they don't have backwards compat concerns maybe they can opt into better<br>
&lt;argyle> well said Lea!<br>
&lt;dael> astearns: leaverou can I ask you to open a separate issue? That way people can weigh in on GH<br>

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

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 20 January 2021 17:31:22 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:38 UTC