Skip to content

[css-color-4] Lch limits on hue value are a bit too limiting #4703

@faceless2

Description

@faceless2

The hue value in Lch is wrapped to the range 0..360° at parse time:

If the provided value is negative, or is greater than or equal to 360deg, it is set to the value modulo 360.

...which seems like a very sensible thing to do, until you try to make a gradient between two colors on either side of 0°.

For example, if I tried to make an Lch gradient from purple (eg hue 335°) through red (hue 0°) to orange (eg hue 60°), I have to split this into two segments - from 335° to 359.999°, and from 0° to 60°. Were it not wrapped, I would be able to transition from hue -25° to 60°.

Hue in HSL is not limited at all, which I think is the best option: a gradient from 0° to 180° is different to one from 0° to 900°, despite the start and end colors being identical. If it is to be limited, it should be at least over a range of 720°

Was previously discussed in #289

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions