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.


bitDepth = window.screen.colorDepth


// check the color depth of the screen
if ( window.screen.colorDepth < 8) {
  // use low-color version of page
} else { 
  // use regular, colorful page


Specification Status Comment
CSS Object Model (CSSOM) View Module
The definition of 'Screen.colorDepth' in that specification.
Working Draft  

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes1 ? Yes ? Yes Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes1 Yes1 ? Yes Yes ? Yes

1. Starting with version 59 this property is no longer required to always return 24.

See also

Document Tags and Contributors

Last updated by: fscholz,