Get the bit depth of the color palette:
var x = "Color Depth: " + screen.colorDepth;
Click the button to display the bit depth of the color palette.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w w w. jav a 2 s. c o m var x = "Color Depth: " + screen.colorDepth + " bits per pixel"; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The colorDepth property returns the bit depth of the color palette in bits per pixel.
Possible values: