Skip to content

[css-color-5] Consider moving colorspace parameter in color-adjust() to beginning to match color-mix() and ease parsing #6053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
weinig opened this issue Feb 28, 2021 · 6 comments

Comments

@weinig
Copy link
Contributor

weinig commented Feb 28, 2021

In the current CSS Color 5 draft's color-adjust() function, https://drafts.csswg.org/css-color-5/#coloradjust, the colorspace is argument is last, which is inconsistent with color-mix(), where it is first, and makes parsing a bit more complicated since we don't know which adjusters are allowed until after we have parsed them.

Please consider moving the colorspace to the beginning, changing the grammar from:

color-adjust() = color-adjust( <color> [ color-adjuster <colorspace>? ]? )

to

color-adjust() = color-adjust(<colorspace>?, <color> [ color-adjuster ]? )
@smfr smfr added the css-color-5 Color modification label Mar 1, 2021
@Myndex
Copy link
Member

Myndex commented Mar 1, 2021

How about moving the "colorspace" in color-mix to the end? And also, not calling it colorspace as in most cases it is not a different colorspace and is only a different color notation?

@samweinig
Copy link

Moving colorspace to the end of color-mix() would make parsing quite a bit more inefficient as you would not know which adjusters were valid as you were parsing them. If adjusters are going to be validated based on colorspace, I think it makes sense for it to come first.

@LeaVerou
Copy link
Member

LeaVerou commented Mar 2, 2021

We actually made some changes to the color space argument, mandating an in keyword before it which allows it to be anywhere in the function. Could you take another look?
We also removed adjusters, so that shouldn't be an issue now.

@samweinig
Copy link

samweinig commented Mar 2, 2021

The current spec (or what I get when I load https://drafts.csswg.org/css-color-5/#coloradjust anyway) has the following grammar now:

color-adjust() = color-adjust( <color> [ color-adjuster [ in <colorspace> ]? ]? )

Which seems to still have adjusters (though it is no longer defined what a color-adjuster production is).

@LeaVerou
Copy link
Member

LeaVerou commented Mar 2, 2021

Whoops, I completely missed that this was about color-adjust() and not color-mix().
I should also resurrect the color adjuster definition and move it there. Thanks!

Edit: done

@svgeesus
Copy link
Contributor

Closed by WG resolution to drop color-adjust()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants