विवरण
HTML Screen colorDepth प्रॉपर्टी इमेज प्रदर्शित करने के लिए कलर पैलेट की बिट डेप्थ लौटाती है (बिट्स प्रति पिक्सेल में)।
सिंटैक्स
screen.colorDepth
उदाहरण
आइए HTML Screen colorDepth प्रॉपर्टी का एक उदाहरण देखें:
<!DOCTYPE html> <html> <style>
body {
color: #000;
height: 100vh;
background-color: #FBAB7E;
background-image: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%);
text-align: center;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 2px;
width: 40%;
display: block;
color: #fff;
outline: none;
cursor: pointer;
margin: 1rem auto;
}
.show {
font-size: 1.2rem;
margin: 1rem auto;
font-weight: bold;
font-family: sans-serif;
}
</style> <body>
<h1>HTML Screen colorDepth प्रॉपर्टी</h1>
<button class="btn" onclick="get()">कलर डेप्थ दिखाएं</button>
<div class="show"></div>
<script>
function get() {
document.querySelector(".show").innerHTML = "कलर डेप्थ है " + screen.colorDepth + " बिट्स प्रति पिक्सेल";
}
</script> </body> </html>
आउटपुट

"कलर डेप्थ दिखाएं" बटन पर क्लिक करके स्क्रीन की कलर डेप्थ प्रदर्शित करें।
