NAME
Synopsis
screen_def_return, exact_def_return)
Display *display;
Colormap colormap;
char *color_name;
XColor *screen_def_return;
XColor *exact_def_return;
Arguments
displaySpecifies a connection to an X server; returned from XOpenDisplay().
colormapSpecifies the ID of the colormap in which the colorcell will be allocated.
color_name
Specifies the color name string (for example, "red") you want. Upper or lower case does not matter. If the color name is not in the Host Portable Character Encoding, the result is implementation-dependent.
screen_def_return
Returns the pixel value and RGB values actually used in the colormap. This is the closest color supported by the hardware.
exact_def_return
Returns the exact RGB values from the database corresponding to the color_name supplied.
Description
determines the RGB values for the specified color_name from the color database, and then allocates a read-only colorcell with the closest color available, as described under XAllocColor(). on static and dynamic visuals. On PseudoColor, DirectColor, and GrayScale colorcells and no allocated read-only colorcell exactly matches the database definition of the requested color. On StaticColor, TrueColor, and StaticGray visuals, (to the database definition of the requested color) available in the colormap. Both the database definition of the color, and the color actually allocated are returned. color_name was not found in the database or if the color could not be allocated. The function returns nonzero when it succeeds. For more information, see Volume One, Chapter 7, Color.
Errors
BadColorcolormap is invalid.
Structures
typedef struct {
unsigned long pixel;
unsigned short red, green, blue;
char flags;/* DoRed, DoGreen, DoBlue */
char pad;
} XColor;
See Also
BlackPixel(), WhitePixel(), XAllocColor(), XAllocColorCells(), XAllocColorPlanes(), XFreeColors(), XLookupColor(), XParseColor(), XQueryColor(), XQueryColors(), XStoreColor(), XStoreColors(),
—