screen.colorDepth และ screen.pixelDepth ให้ข้อมูลความลึกสีและพิกเซลของหน้าจอ (บิตต่อพิกเซล)
Color Depth
จำนวนบิตที่ใช้แสดงสีหนึ่งสี คอมพิวเตอร์สมัยใหม่ใช้ 24 หรือ 32 บิต
<html> <body>
<p id="depth"></p>
<script>
document.getElementById("depth").innerHTML = "Screen color depth is " + screen.colorDepth;
</script> </body> </html>
ผลลัพธ์
Screen color depth is 24
Pixel Depth
<html> <body>
<p id="depth"></p>
<script>
document.getElementById("depth").innerHTML = "Screen pixel depth is " + screen.pixelDepth;
</script> </body> </html>
ผลลัพธ์
Screen pixel depth is 24