Screen colorDepth Property

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP







<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->



Screen colorDepth Property


❮ Screen Object




Example


Get the bit depth of the color palette:



var x = "Color Depth: " + screen.colorDepth;

<!--

The result of x will be:





document.write("Color Depth: " + screen.colorDepth);
-->
Try it Yourself »

More "Try it Yourself" examples below.



Definition and Usage


The colorDepth property returns the bit depth of the color palette for
displaying images (in bits per pixel).



Browser Support














Property
colorDepth Yes Yes Yes Yes Yes

Syntax



screen.colorDepth





<!--
mid_content, all: [300,250][336,280][728,90][970,250][970,90][320,50][468,60]
-->




Technical Details




Return Value: A Number, representing the bit depth of the color palette for displaying images, in bits per pixel.

Possible values:
  • 1 bit per pixel

  • 4 bits per pixel

  • 8 bits per pixel

  • 15 bits per pixel

  • 16 bits per pixel

  • 24 bits per pixel

  • 32 bits per pixel

  • 48 bits per pixel


More Examples



Example


Display an alternate background color for 8 bit screens (to avoid that 8 bit
screens, which do not support the modern color, uses an ugly substitute color
instead):



if (screen.colorDepth <= 8)

  //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"

Try it Yourself »



Example


All screen properties in one example:



var txt = "";
txt += "<p>Total width/height: " + screen.width + "*" + screen.height + "</p>";
txt += "<p>Available width/height: " + screen.availWidth + "*" + screen.availHeight + "</p>";
txt += "<p>Color depth: " + screen.colorDepth + "</p>";
txt += "<p>Color resolution: " + screen.pixelDepth + "</p>";

Try it Yourself »



❮ Screen Object

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)