JavaScript  -  Screen Colour Depth

Option 1.   Save this script in the <head> of your html document

<script type="text/javascript">
var colBit1 = screen.colorDepth;
</script>

and use this script in the <body>

<script type="text/javascript">
<!--
document.write(""+colBit1+"-bit");
//-->
</script>

Screen Colour Depth - Displays:

 

Option 2.   Save this script in your js folder

Save the following script as colourdepth.js

<!--
var colBit2 = screen.colorDepth;
document.write(""+colBit2+"-bit");
// or
// document.write(""+screen.colorDepth+"-bit");
// without variable
//-->

and refer to it in the <body> of your html document

<script src="/js/colourdepth.js" type="text/javascript"></script>

Screen Colour Depth - Displays:

 

Option 3.   Embed this script in the <body> of your html document

<script type="text/javascript">
<!--
var colBit3 = screen.colorDepth;
document.write("Screen Colour Depth is "+colBit3+"-bpp");
// or
// document.write("Screen Colour Depth is "+screen.colorDepth+"-bpp");
// without variable
//--> </script>

Screen Colour Depth - Displays:

 

In computer graphics, colour depth, or bit depth, is the number of bits used to represent the colour of a single pixel in a bit-mapped image or video frame buffer. This concept is also known as bits per pixel (bpp), particularly when specified along with the number of bits used. Higher colour depth gives a broader range of distinct colors. Colour depth is only one aspect of colour representation expressing how finely levels of colour can be expressed; the other aspect is how broad a range of colours can be expressed, the gamut.