Skip to content

[css-color-4] Parse-time clip of HSL negative saturation for modern syntax? #9222

Description

@romainmenke

: (max - light) / Math.min(light, 1 - light);

rgbToHsl(1.5, 1, 1)
// (3) [0, -100, 125]

This only happens when the sum of all channels exceeds 3.

  • rgbToHsl(1.5, 1, 0.5) -> negative saturation
  • rgbToHsl(1.499999, 1, 0.5) -> very high, but positive saturation of 99999900

I get better results when I clamp saturation to 0.


I don't know if clamping to 0 had unintended side effects here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    Wednesday morning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions