
How to determine the number of colors (bits per pixel) in X11
August 31, 2023
How to determine the number of colors (bits per pixel) in X11
How can I find out how many bits per pixel are actually available in a running X11 session?
To check the system-wide value, run the command:
xwininfo -root | grep Depth
Example output:
Depth: 24
The following command will print the supported bitness values for the root window:
xdpyinfo | grep depths
The first number indicates the current bit depth:
depths (7): 24, 1, 4, 8, 15, 16, 32
In X windows, each window can choose which bit depth to use from a list of available bit depths. To find out the bit depth of a specific window, run the command in the terminal:
xwininfo
Then click on a window. The result will be displayed in the terminal, what is in the “Depth:” line is the bit depth, that is, the number of bits per pixel.
Some windows show 24-bit color depth, and some applications (Google Chrome and Firefox web browsers) show 32-bit color depth.
If you prefer a graphical interface, then launch SMPlayer and go to “View” → “Information about connected screens” from the menu.
A window with display properties will open. Here you will find the “Depth” item, which indicates the color depth.
30-bit color depth on Linux
The previous examples show the output when using 8-bit (or equivalently 24-bit) color depth.
The following examples show the output if Linux has 10-bit (or equivalently 30-bit) color depth enabled.
Let's check again the current color depth values that the operating system uses to make sure that the settings actually had an effect:
xwininfo -root | grep Depth
Now the color depth is 30:
Depth: 30
Let's also check the color depth in Linux using the xdpyinfo utility:
xdpyinfo | grep depths
Instead of 7, it now shows 8 supported color depths, using 30-bit depth:
depths (8): 30, 1, 4, 8, 15, 16, 24, 32
The xwininfo utility also shows a color depth of 30-bit:
xwininfo
If you prefer a graphical interface, then launch SMPlayer and go to “View” → “Information about connected screens” from the menu.
Related articles:
- How to enable 10-bit color depth on Linux (and whether to enable 30-bit color) (100%)
- How to identify content with 10-bit color depth. How to check what color depth is used in a photo and video (63.7%)
- Why Google Chrome web browser is gray when 10-bit color is enabled and how to fix it (59.3%)
- How to watch HDR videos on YouTube on Linux (59.3%)
- How to enable HDR monitor support in Linux (57%)
- How to find and remove non-UTF-8 characters from a text file (RANDOM - 50%)
