Name

colorDepth — NN 4 IE 4 DOM n/a

Synopsis

Read-only

Returns the number of bits per pixel used to display color in the video monitor or image buffer. Although this property is read-only, its value can be influenced by settings of the bufferDepth property (IE only). You can determine the color depth of the current video screen and select colors accordingly.

Example

if (screen.colorDepth > 8) {
    document.all.pretty.color = "cornflowerblue"
} else {
    document.all.pretty.color = "blue"
}

Value

Integer.

Default

Current video control panel setting.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.