Skip to content

[css-color-4] hsl() modern syntax allows <number> but seems to be lacking details and WPT tests #8515

@romainmenke

Description

@romainmenke

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

<modern-hsl-syntax> = hsl( 
    [<hue> | none] 
    [<percentage> | <number> | none] 
    [<percentage> | <number> | none] 
    [ / [<alpha-value> | none] ]? )

The prose and the examples don't give any indication or even mention <number>.
I also couldn't find any WPT tests, but there are many and I might be overlooking cases where % was omitted.

I am assuming this was a recent addition because no browser implements support for numbers in s and/or l

* {
  background-color: hsl(50deg 0.5 0.5);
  background-color: hsl(50deg 50 50);
}

All other color functions that support numbers and percentages have the percentage range in prose or in a section :

Percent reference range 	for L: 0% = 0.0, 100% = 1.0
                                for C: 0% = 0.0 100% = 0.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions