Skip to content
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

[css-color-5] Only hsl and hwb have channel values as percentages in RCS #9016

Closed
romainmenke opened this issue Jun 29, 2023 · 10 comments
Closed

Comments

@romainmenke
Copy link
Member

romainmenke commented Jun 29, 2023

I was going over the list of changes in css-color-5 and I noticed that only hsl and hwb have channel keywords in RCS that have percentage values.

Both however also allow number values as regular arguments.
In css-color-5 these are both valid and equal :

  • hwb(90deg 25% 25%)
  • hwb(90deg 25 25)

@svgeesus is there a reason not to give the channel keywords the number type?
That would make these two color functions more consistent with every other color function.

@svgeesus
Copy link
Contributor

svgeesus commented Jul 1, 2023

No, it looks like just a failure on my part to update all affected parts of the spec. This edit changed

They are <<number>>s or <<percentage>>s

to

They are <<number>>s

but only for relative color() not for other color functions.

You are right that hsl() and hwb() were changed to always allow number or percentage, and the CSS WG resolution was that channel keywords should resolve to <number>.

  • RESOLVED: keywords with multiple specified types result in number

@tabatkins had pointed out that channel keywords were still using percentage for HWB, and I stated that this was correct because that predated the resolution (which was made on the call that same day).

And the spec was even changed elsewhere to refer to these being number for HSL and HWB, see this edit, as part of #8322.

So I should fix that, for consistency. Thanks for your careful review!

@svgeesus
Copy link
Contributor

svgeesus commented Jul 1, 2023

Also from the intro to RCS;

The channel keywords return a <number>; if they were originally specified as a <percentage> or an <angle>, that <percentage> is resolved to a <number> and the <angle> is resolved to a <number> of degrees (which is the canonical unit) in the range [0, 360].

@svgeesus
Copy link
Contributor

svgeesus commented Jul 1, 2023

Relevant tests to check:

Add subtests with calc(), to check correct types used, on:

  • HSL hue
  • HSL L and S
  • HWB hue
  • HWB W and B
  • LCH hue
  • Oklch hue

@romainmenke
Copy link
Member Author

One more :)

* <dfn value for="oklch()">h</dfn> is an <<angle>>

@svgeesus
Copy link
Contributor

svgeesus commented Jul 1, 2023

Thanks!

@romainmenke
Copy link
Member Author

Thank you for these edits and clarifications 🙇

@svgeesus
Copy link
Contributor

svgeesus commented Jul 1, 2023

(Leaving the issue open so I don't forget about the need for testcase review and supplementation)

@romainmenke
Copy link
Member Author

I've added a few tests that should also cover this issue : web-platform-tests/wpt#43931

@svgeesus
Copy link
Contributor

Cheers, I just approved them.

@svgeesus
Copy link
Contributor

The spec is now correct and the tests are updated, so I believe this can be closed.

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

2 participants