[csswg-drafts] [css-color-4][mediaqueries-5] add <kelvin()> color-function and @uses-color-filter media-feature (#6582)

elsiehupp has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color-4][mediaqueries-5] add <kelvin()> color-function and @uses-color-filter media-feature ==
> ## Note:
>
> This Issue covers two ***related*** feature proposals applying to two ***separate*** specification drafts. It may be preferable to split this into two separate Issues with links between them instead.

## `<kelvin()>` color-function

Presently, the `css-color-4` draft provides the [**color-function**](https://drafts.csswg.org/css-color-4/#color-syntax) options `<rgb()>`, `<rgba()>`, `<hsl()>`, `<hsla()>`, `<hwb()>`, `<lab()>`, `<lch()>`, and `<color()>`. However, consumer lighting devices are increasingly marketed with the color specified in terms of the [Kelvin temperature](https://en.wikipedia.org/wiki/Color_temperature) ("CCT") of a black-body radiator emitting that color of visible light. Kelvin temperature is a single scalar value, and the path of this value, the [Planckian locus](https://en.wikipedia.org/wiki/Planckian_locus), can be mapped onto various color spaces using well-known formulas.

Software such as [f.lux](https://justgetflux.com/), [redshift](https://github.com/jonls/redshift), and [red-moon](https://github.com/LibreShift/red-moon) already provides (usually global) color filters for consumer video display devices.

A web designer or software developer may wish to assign a CCT color, but presently they would need to make use of an external algorithm to translate it into a value accepted by one of the existing CSS **color-function** options.

> **Note:** while negative Kelvin temperatures do not physically exist, a negative color value passed to `<kelvin()>` could, for example, provide the inverse of the color provided by the same positive value, which could be useful for counteracting inherited color filters.

---

## `@uses-color-filter` media-feature

For certain purposes, however, such as cinematic color grading, an end user may need certain visual elements to follow a defined color specification. Additionally, web designers and software developers may wish to offer color filters when a color filter is not already present.

In order to allow web designers and software developers to counteract an otherwise globally enabled color filter for certain visual elements or to offer local color filters in the absence of a globally enabled one, CSS could provide a **media-feature** with the `<color>` and `<mix-blend-mode>` values of any filters applied by the renderer or the system. This **media-feature** could be named something like `@uses-color-filter`.

There does not appear to be anything on this topic in the `mediaqueries-5` draft, so I am basing this idea on the existing [`@prefers-color-scheme`](https://drafts.csswg.org/mediaqueries-5/#prefers-color-scheme) feature, thought it could also be analogous to the existing [`@color-gamut`](https://drafts.csswg.org/mediaqueries-5/#color-gamut) and [`@inverted-colors`](https://drafts.csswg.org/mediaqueries-5/#inverted) media features.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6582 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 7 September 2021 22:39:04 UTC