Screen: colorDepth-Eigenschaft
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Die schreibgeschützte Eigenschaft Screen.colorDepth
gibt die Farbtiefe des Bildschirms zurück. Gemäß dem CSSOM geben einige Implementierungen 24
aus Kompatibilitätsgründen zurück. Siehe den Abschnitt zur Browser-Kompatibilität für diejenigen, die dies nicht tun.
Wert
Eine Zahl.
Beispiele
js
// Check the color depth of the screen
if (window.screen.colorDepth < 8) {
// Use low-color version of page
} else {
// Use regular, colorful page
}
Spezifikationen
Specification |
---|
CSSOM View Module # dom-screen-colordepth |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
colorDepth |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.