Screen colorDepth 属性
最后更新于:2022-03-26 22:11:03
Screen colorDepth 属性
定义和用法
colorDepth 属性返回目标设备或缓冲器上的调色板的比特深度。
语法
screen.colorDepth
浏览器支持
所有主要浏览器都支持 colorDepth 属性
实例s
实例 2
在8比特屏显示交替的背景颜色:
if (screen.colorDepth<=8)
//为8位屏幕的简单的蓝色背景色
document.body.style.background=”#0000FF”
else
//为现代屏幕的华丽的蓝色背景色
document.body.style.background=”#87CEFA”
//为8位屏幕的简单的蓝色背景色
document.body.style.background=”#0000FF”
else
//为现代屏幕的华丽的蓝色背景色
document.body.style.background=”#87CEFA”
