Window screen.colorDepth 属性
- အခြေခံ ပါး availWidth
- နောက်ဆုံး ပါး height
- အခြေခံ ပြန်ရေး Window Screen
定义和用法
colorDepth
属性返回屏幕的颜色深度。
colorDepth
属性返回每像素位的深度。
colorDepth
属性是只读的。
实例
例子 1
获取调色板的位深度:
let depth = screen.colorDepth;
例子 2
为 8 位屏幕显示替代背景颜色(为避免不支持现代颜色的 8 位屏幕使用难看的替代颜色):
if (screen.colorDepth <= 8) // 8 ပေါ် လုံးပါဝင် ပန်းထုတ်စက် သည် အကြိမ် document.body.style.background = "#0000FF" else // သန်းကျင် လုံးပါဝင် ပန်းထုတ်စက် သည် အခြေခံ အကြိမ် document.body.style.background = "#87CEFA"
အမှတ် 3 ပုံ
အားလုံး လုံးပါဝင် ဖောင်း
let text = "Total width/height: " + screen.width + "*" + screen.height + "<br>" "Available width/height: " + screen.availWidth + "*" + screen.availHeight + "<br>" "Color depth: " + screen.colorDepth + "<br>" "Color resolution: " + screen.pixelDepth;
အက္ခရာ
screen.colorDepth
ပြန်လည်ပေးသော အရင်း
အမျိုးအစား | ဖော်ပြ |
---|---|
နှုတ် |
လုံးပါဝင် ပန်းထုတ်စက် သည် ပေါ် ပမာဏ (အသုံးပြီး ပေါ် ပမာဏ အတွက်): 1, 4, 8, 15, 16, 24, 32, သို့မဟုတ် 48。 |
ဘရောက်သတ် ဘရောက်သတ်
အားလုံး ဘရောက်သတ် screen.colorDepth
:
ခရမ်း | အိုင်အို | အင်ဂျင် | ဖရက်ခ် | ဆာဖာဖီ | အိုပရက် |
---|---|---|---|---|---|
ခရမ်း | အိုင်အို | အင်ဂျင် | ဖရက်ခ် | ဆာဖာဖီ | အိုပရက် |
ထောက်ပံ့ | ထောက်ပံ့ | ထောက်ပံ့ | ထောက်ပံ့ | ထောက်ပံ့ | ထောက်ပံ့ |
ပါဝင်သော စာမျက်နှာ
- အခြေခံ ပါး availWidth
- နောက်ဆုံး ပါး height
- အခြေခံ ပြန်ရေး Window Screen