Screen.pixelDepth

  • Revision slug: DOM/window.screen.pixelDepth
  • Revision title: window.screen.pixelDepth
  • Revision id: 176113
  • Created:
  • Creator: Gor1
  • Is current revision? No
  • Comment

Revision Content

{{template.DomRef()}}

Summary

Returns the bit depth of the screen.

Syntax

depth = window.screen.pixelDepth

Example

// if there is not adequate bit depth
// choose a simpler color
if ( window.screen.pixelDepth > 8 ) {
   document.style.color = "#FAEBD7";
} else {
   document.style.color = "#FFFFFF";
}

Notes

See also window.screen.colorDepth.

Specification

DOM Level 0. Not part of specification.

Revision Source

<p>
{{template.DomRef()}}
</p>
<h3 name="Summary"> Summary </h3>
<p>Returns the bit depth of the screen.
</p>
<h3 name="Syntax"> Syntax </h3>
<pre class="eval">depth = window.screen.pixelDepth
</pre>
<h3 name="Example"> Example </h3>
<pre class="eval">// if there is not adequate bit depth
// choose a simpler color
if ( window.screen.pixelDepth &gt; 8 ) {
   document.style.color = "#FAEBD7";
} else {
   document.style.color = "#FFFFFF";
}
</pre>
<h3 name="Notes"> Notes </h3>
<p>See also <a href="en/DOM/window.screen.colorDepth">window.screen.colorDepth</a>.
</p>
<h3 name="Specification"> Specification </h3>
<p>DOM Level 0. Not part of specification.
</p>
Revert to this revision