Javascript examples for Browser Object Model:Screen
The colorDepth property returns the bit depth of the color palette for displaying images.
A Number, representing the bit depth of the color palette for displaying images, in bits per pixel.
Possible values:
The following code shows how to get the bit depth of the color palette:
<!DOCTYPE html> <html> <body> <script> if (screen.colorDepth <= 8)/* w w w.java2 s.c om*/ //simple blue background color for 8 bit screens document.body.style.background = "#0000FF" else //fancy blue background color for modern screens document.body.style.background = "#87CEFA" </script> </body> </html>