Closed Bug 1862918 Opened 11 months ago Closed 11 months ago

[css-color] Modern HSL syntax should allow numbers as well as percentage.

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1864258

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.

Severity: -- → S3
Keywords: dev-doc-needed
Assignee: nobody → tlouw

The spec for hsl() notation allows for numbers or percentage components.

https://drafts.csswg.org/css-color-4/#the-hsl-notation

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.

Flags: needinfo?(chris)

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.

Flags: needinfo?(chris)

color-valid-hsl.html wpt test doesn't test for these values either.

It should.

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 :/

Attachment #9363103 - Attachment is obsolete: true

Merged with bug 1864258.

Status: NEW → RESOLVED
Closed: 11 months ago
Duplicate of bug: 1864258
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: