Skip to content

[css-color-4] Should gray() accept percentage for lightness? #4648

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
smfr opened this issue Jan 3, 2020 · 3 comments
Closed

[css-color-4] Should gray() accept percentage for lightness? #4648

smfr opened this issue Jan 3, 2020 · 3 comments

Comments

@smfr
Copy link
Contributor

smfr commented Jan 3, 2020

https://www.w3.org/TR/css-color-4/#grays

As the spec says, gray(a / b) is equivalent to lab(a 0 0 / b). However, lab() and lch() both take a percentage as the lightness argument, but gray() is specified to take a number (where 50 is equivalent to 50%). That's confusing if we expect authors to think of gray() as just a shorthand for lab().

So I suggest we spec gray as:
gray() = gray( <percentage> [ / <alpha-value> ]? )

@smfr smfr added Agenda+ css-color-4 Current Work labels Jan 3, 2020
@AmeliaBR
Copy link
Contributor

AmeliaBR commented Jan 3, 2020

I strongly agree with this. I don't think we have any other color functions where numbers are mapped in the range 0-100. If we're using a 0-100 range, it makes sense to use a proper percentage type.

@Crissov
Copy link
Contributor

Crissov commented Jan 5, 2020

Yes, this the only logical consequences of #4477 (or #3450 and #278), but pending the resultion of #4621. Furthermore, #4494 would perhaps allow gray(50%) to equal gray(0.5), but not gray(50).

@svgeesus
Copy link
Contributor

svgeesus commented Jan 6, 2020

Agreed, this just needs the edits. I made them for lab() and lch() but failed to also make them for gray().

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

4 participants