[css-color] Modern HSL syntax should allow numbers as well as percentage.
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
People
(Reporter: tlouw, Assigned: tlouw)
Details
(Keywords: dev-doc-needed)
Attachments
(1 obsolete file)
According to:
https://drafts.csswg.org/css-color-4/#the-hsl-notation
the modern HSL syntax allows percentages and numbers for the saturation and lightness components:
<modern-hsl-syntax> = hsl(
[<hue> | none]
[<percentage> | <number> | none]
[<percentage> | <number> | none]
[ / [<alpha-value> | none] ]? )
Currently we only parse percentages for the modern syntax.
hsl(20deg 50 40)
should be a valid hsl value. The color-valid-hsl.html
wpt test doesn't test for these values either.
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 1•1 year ago
|
||
The spec for hsl() notation allows for numbers or percentage components.
Comment 2•1 year ago
|
||
This seems like an oversight in the spec? The spec doesn't define what those numbers are relative to, and it seems very weird to treat them just like a percentage.
The spec does define where percentages are allowed and what the equivalent numbers are:
Percentages Allowed for S and L
Percent reference range for S and L: 0% = 0.0, 100% = 100.0
so hsl(20deg 50 40) is valid, and the same as hsl(20deg 50% 40%)
But I see that this later paragraph needs to be updated for this:
The next two arguments are the saturation and lightness, respectively. For saturation, 100% is a fully-saturated, bright color, and 0% is a fully-unsaturated gray. For lightness, 50% represents the "normal" color, while 100% is white and 0% is black.
should be
The next two arguments are the saturation and lightness, respectively. For saturation, 100% or 100 is a fully-saturated, bright color, and 0% or 0 is a fully-unsaturated gray. For lightness, 50% ror 50 epresents the "normal" color, while 100% 0r 100 is white and 0% or 0 is black.
color-valid-hsl.html wpt test doesn't test for these values either.
It should.
Comment 5•1 year ago
|
||
Yeah, sorry, I realized that this was intended (https://github.com/w3c/csswg-drafts/issues/8322) and commented on the patch. But still kind of unfortunate the spec change landed with zero tests :/
Fixed spec inconsistency with https://github.com/w3c/csswg-drafts/commit/481965809e37cada90d4f17ec49c8a9738e2efbe
Updated•1 year ago
|
Assignee | ||
Comment 7•1 year ago
|
||
Merged with bug 1864258.
Description
•