colorDepthcolorDepth*
*Contents  *Index  *Topic Contents
*Previous Topic: color
*Next Topic: cols

colorDepth

Description

Returns the bits-per-pixel value used for colors on the destination device or buffer. Script programmers use this value when deciding how best to use colors.

Syntax

object.colorDepth

Settings

The value of this read-only property depends on the bufferDepth property. If bufferDepth is 0 or -1, colorDepth is equal to the bits-per-pixel value for the screen or printer. If bufferDepth is nonzero, colorDepth is equal to bufferDepth.

Example

The following JScript example picks foreground and background colors based on the color depth of the screen.

if (screen.colorDepth > 2) {
    document.body.bgColor = "white";
    document.body.color = "blue";
} else {
    document.body.bgColor = "black";
    document.body.color = "white";
}

Applies To

screen


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.