The Screen.colorDepth
read-only property returns the color depth of the screen. Per the CSSOM, some implementations return 24
for compatibility reasons. See the browser compatibility section for those that don't.
Syntax
bitDepth = window.screen.colorDepth;
Example
// Check the color depth of the screen if ( window.screen.colorDepth < 8) { // Use low-color version of page } else { // Use regular, colorful page }
Specification
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) View ModuleThe definition of 'Screen.colorDepth' in that specification. | Working Draft |
Browser compatibility
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.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
colorDepth
|
Chrome Full support 40 Full support 40 Notes' Starting with version 59 this property is no longer required to always return 24. |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android Full support 40 Full support 40 Notes' Starting with version 59 this property is no longer required to always return 24. |
Chrome Android Full support 40 Full support 40 Notes' Starting with version 59 this property is no longer required to always return 24. |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android Full support 4.0 Full support 4.0 Notes' Starting with Samsung Internet 7.0 this property is no longer required to always return 24. |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
- See implementation notes.'
- See implementation notes.
See also
Screen.colorDepth by Mozilla Contributors is licensed under CC-BY-SA 2.5.