dynamic-range
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since May 2022.
The dynamic-range
CSS media feature can be used to test the combination of brightness, contrast ratio, and color depth that are supported by the user agent and the output device.
Note: Some devices have high dynamic range capabilities that are not always 'on' and need to be activated (sometimes programmatically, sometimes by the user, sometimes based on the content). This media feature does not test whether the dynamic range capability is active; it only tests whether the device is capable of high dynamic range visuals.
Syntax
The dynamic-range
feature is specified as a keyword value chosen from the list below.
standard
-
This value matches any visual device and excludes devices lacking visual capabilities. A user agent or an output device that matches
high
will also match thestandard
value. high
-
This value matches user agents and output devices that support high peak brightness, high contrast ratio, and color depth greater than 24 bit or 8 bit per color component of RGB. Peak brightness refers to how bright the brightest point a light-emitting device, such as an LCD screen, can produce. In the case of a light-reflective device, such as paper or e-ink, peak brightness refers to the point that at least absorbs light. Contrast ratio refers to the ratio of the luminance of the brightest color to that of the darkest color that the system is capable of producing. Currently, there is no precise way to measure peak brightness and contrast ratio, and the determination of what counts as high peak brightness and high contrast ratio depends on the user agent.
Examples
@media (dynamic-range: standard) {
p {
color: red;
}
}
@media (dynamic-range: high) {
p {
color: green;
}
}
Specifications
Specification |
---|
Media Queries Level 5 # dynamic-range |
Browser compatibility
BCD tables only load in the browser