Skip to content

[css-color-4] How to handle conversions that result in negative lightness? #9484

Description

@nex3

It's possible for a color conversion to result in negative lightness. For example, the color lab(1% 60 100) is naively equivalent to oklab(-4.8743815325% 0.7106198377 0.1847214228). Negative lightnesses are generally disallowed, but the spec is only explicit that they should be clamped at parsed-value time, which leaves it ambiguous what to do when they come up as the result of a conversion.

It's not clear to me what the right solution is here. If you clamp eagerly, you break the ability to round-trip safely between Lab and OKLab. Clamping at parsed-value time means that there are valid Lab colors which can't be represented in OKLab. Is this acceptable? If not, how should it be solved?

Edit: A more prominent example is color(xyz-d65 1 1 1), which can't be exactly represented in Lab without a lightness above 100% because Lab uses a d50 whitepoint.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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