'Pixel Depth vs. Color Depth

The question is, what is the difference between color depth and pixel depth?

Searching Pixel Depth on google simply give links to Color Depth. Even the dictionary defines pixel Depth as bit depth, which according to wikipedea is actually Color Depth. Wikipedia says,

Color depth, also known as bit depth, is either the number of bits used to indicate the color of a single pixel...

So does it mean "Color Depth", "Bit Depth" and "Pixel Depth" are all one and the same thing? If yes then is this w3schools article wrong which says,

For modern computers, Color Depth and Pixel Depth are equal.

The line above implies in older computer Color Depth and Pixel Depth were different.



Solution 1:[1]

Nice, all that w3Schools bashing in the comments, but they are actually right. The article is not about the terms pixel depth vs color depth, but about the properties of the screen object.

screen.pixelDepth and screen.colorDepth are two different properties, so it's imaginable that they have different values.

At the time of writing this answer, they were fixed to 24 (says also Mozilla). This is by specification, although there was a bug in WebKit that made it return 32..

The examples on the Mozilla page suggest that they could be lower, but currently (on modern computers, including modern smartphones) they are often 24. Some browsers on some devices may return higher values too, but 24 is by specification the standard value when the browser doesn't know the actual value, or doesn't want to expose it. Whichever, they are linked nowadays, and both properies should return the same value.

The real answer can be found on QuirksMode:

The difference between colorDepth and pixelDepth is only important on (older?) Unix machines, where old X-clients may allow applications to define their own color scheme. If that’s the case, colorDepth matches the color depth of the application and pixelDepth the color depth of the monitor. In all other cases they’re equal.

So it seems that that remark is correct.

In daily use, you might consider using colorDepth, because pixelDepth is not supported in IE8 and before, although that is hardly relevant today.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1