Skip to content

[css-color] sRGB transfer curve outside 0.0 to 1.0 range #288

@svgeesus

Description

@svgeesus

https://drafts.csswg.org/css-color/#rgb-functions

The transfer function is undefined outside the range 0% to 100%.

Earlier levels of CSS expressed a vague hope that wider gamut colors could be expressed using sRGB and values less than zero, or greater that 1.0. This approach requires an extension of the transfer curve (there are several possible ways to do so, and the method uis undefined) and does not fit well with current industry practice which uses an appropriately large colorspace and only in-gamut values.

Thus, css-color-4 gives a better way to do the same thing (the color, lab and lch functions).

Out-of-gamut sRGB colors are poorly supported in current browsers and the clipping method is undefined (there are several possibilities, scaling of all color components towards the grey axis in an additive colorspace is the preferred method, while merely truncating one component and leaving any in-range components unchanged is the ugliest and the most widely implemented if clipping is done. Or, maybe the declaration is skipped or some color like black is returned.

Web compat needs to be studied - are there sites using out of gamut colors in sRGB and if so what behaviour are they relying on. I suspect that there are few such sites and the behaviour is browser dependent but would like to see data.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions