7.2 Color Naming and Specification
The following sections describe the various ways to specify what color you want. In programs that use color only for decoration, the programmer simply chooses default colors, and allows the user to override them with resources.
7.2.1 The Server-side Color Name Database
In order to simplify color specification and to promote sharing of colors, the X server provides a color database that translates string color names into RGB values. Mainly this is a user convenience, since it is easy to specify “yellow” than to figure out the RGB values for yellow. But it also encourages colorcell sharing. As described above, sharing of colorcells can happen only if two clients allocate a read-only cell with the exact same RGB values. If both clients allocate a color specified by one of the 300-odd string names, there is a much better chance of them selecting the exact same RGB values and thereby sharing a cell than if they use one of the 2 48 possible combinations of RGB values.
Because of differences in screen hardware, the same RGB values may generate quite different colors on different hardware. Therefore, server implementors were intended to change the RGB values corresponding to each color name to make sure that the appropriate color appears on their screen. This is called gamma correction. By using names from this database, you are more sure of getting a color close to the one you request. If the server implementor has not provided a gamma-corrected color database, ...
Get XLIB Programming Manual, Rel. 5, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.