E470 [css-color] Computing lch/lab to srgb with lightness = 0% or 100% · Issue #8794 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-color] Computing lch/lab to srgb with lightness = 0% or 100% #8794

@yiyix

Description

@yiyix

According to the spec, "The first argument specifies the CIE Lightness, L. This is a number between 0% or 0 (representing black) and 100% or 100 (representing white), Values less than 0% or 0 must be clamped to 0% at parsed-value time; values greater than 100% or 100 are clamped to 100% at parsed-value time"

With the current color conversion algorithm, both Chrome and Safari are still using a and b (or c and h) when lightness is at 0% or 100%. example: https://jsfiddle.net/orah1qd2/ lab(0, 100, 100) is showing as some shade of red instead of black.

I am trying to understand how the color conversion works for lightness at 0% or 100%.

  • Does it follow the current conversion algorithm and convert to White/Black when lightness is at 0% or 100%? The issue is it will not create a nice color spectrum and users might be surprised to see this when the color doesn't change with a and b (or c and h) for l at 0 (or 100).
  • Or our current color conversion algorithm is wrong, and we should rewrite and convert to black and white smoothly as lightness hit 0% or 100%? I think the issue here is that color spectrum would look very different.

Thank you for helping.

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

      0