Saturday 9 February 2019

colors - 48-bit colours?


Quite often, especially in X11-related things (X resources, Roxterm themes, etc) I see colours specified as 48-bit numbers: #2e2e34343636, #cccc00000000 instead of the usual 24-bit #2e3436 and #cc0000. What are the extra bits used for?



Answer



I found the answer in Xlib documentation under "Color strings". It seems that Xlib actually uses 16 bit RGB values for colors:



RGB Device String Specification


[...] an older syntax for RGB Device is supported, but its continued use is not encouraged. The syntax is an initial sharp sign character followed by a numeric specification, in one of the following formats:


#RGB          (4 bits each)
#RRGGBB (8 bits each)
#RRRGGGBBB (12 bits each)
#RRRRGGGGBBBB (16 bits each)

The R, G, and B represent single hexadecimal digits. When fewer than 16 bits each are specified, they represent the most significant bits of the value (unlike the “rgb:” syntax, in which values are scaled). For example, the string “#3a7” is the same as “#3000a0007000”.



No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...