Window screen.pixelDepth
Example
Get the color resolution of your screen:
let depth = screen.pixelDepth;
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The pixelDepth
property returns the screen's color depth.
The pixelDepth
property returns the color depth in bits per pixel.
The pixelDepth
property is read-only.
See Also:
The screen.colorDepth property
Note
The pixelDepth property is not supported in Internet Explorer 9 and earlier.
However, pixelDepth and colorDepth returns the same value.
Since all browsers support colorDepth, use that property instead.
Syntax
screen.pixelDepth
Return Value
Type | Description |
A number | The color resolution in bits per pixel: 1, 4, 8, 15, 16, 24, 32, or 48. |
More Examples
All screen properties:
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;
Try it Yourself »
Browser Support
screen.pixelDepth
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |