colorDepth property in JavaScript

colorDepth property in JavaScript

 
colorDepth property in Javascript is used to return the bit depth of the color palette, which is used for displaying images.
 
Ex:
  1. <html>  
  2.   
  3.    <body>  
  4.       <script type="text/javascript">  
  5.       if (screen.colorDepth <= 8)  
  6.          document.body.style.background = "Red"  
  7.       else  
  8.          document.body.style.background = "Green"  
  9.       </script>  
  10.    </body>  
  11.   
  12. </html> 
1.png