Screen colorDepth Property
Screen object
Definition and Usage
The colorDepth property returns the bit depth of the palette on the target device or buffer.
Syntax
screen.colorDepth
Browser support





All major browsers support the colorDepth property
Examples
Example 1
Return the bit depth of the palette:
The output of the above example is:
Try it »
Example 2
Display alternating background colors on an 8-bit screen:
if (screen.colorDepth<=8)
// A simple blue background color for 8-bit screens
document.body.style.background="#0000FF"
else
// A fancy blue background color for modern screens
document.body.style.background="#87CEFA"
Try it »
More examples
This example contains all screen properties
Screen object