창 화면.colorDepth
예시
색상 팔레트의 비트 심도 가져오기:
let depth = screen.colorDepth;
아래에서 더 많은 "직접 사용해 보기" 예를 살펴보세요.
정의 및 사용
속성 은 colorDepth
화면의 색 농도를 반환합니다.
속성 은 colorDepth
픽셀당 비트 수로 깊이를 반환합니다.
속성 은 colorDepth
읽기 전용입니다.
통사론
screen.colorDepth
반환 값
유형 | 설명 |
번호 | 픽셀당 비트 단위의 화면 색상 팔레트 깊이: 1, 4, 8, 15, 16, 24, 32 또는 48. |
더 많은 예
8비트 화면에 대한 대체 배경색 표시(현대 색상을 지원하지 않는 8비트 화면이 대신 못생긴 대체 색상을 사용하는 것을 피하기 위해):
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"
모든 화면 속성:
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
모든 브라우저에서 지원됩니다:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |