Javascript Reference
Categories: screen

javascript screen colorDepth

@March 15, 2008, 1:22 a.m.
colorDepthFirefox/Netscape/NN 4 IE 4 Chrome/Safari/DOM n/a  

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.getElementById("pretty").color = "cornflowerblue";
} else {
    document.getElementById("pretty").color = "blue";
}
 
Value

Integer.

 
Default

Current video control panel setting.


Powered by Linode.