colorDepth
Screen colorDepth 属性
定义和用法
colorDepth 属性返回目标设备或缓冲器上的调色板的比特深度。
语法
screen.colorDepth
浏览器支持
所有主要浏览器都支持 colorDepth 属性
实例 1
返回调色板的位深度:
<script>
document.write("Color Depth: " + screen.colorDepth);
</script>
document.write("Color Depth: " + screen.colorDepth);
</script>
实例 2
在8比特屏显示交替的背景颜色:
<script>
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"
</script>
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"
</script>