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. <body>
  3. <script type="text/javascript">
  4. if (screen.colorDepth <= 8)
  5. document.body.style.background = "Red"
  6. else
  7. document.body.style.background = "Green"
  8. </script>
  9. </body>
  10. </html>
1.png