XAllocNamedColor

Syntax

Status XAllocNamedColor(display, colormap, \
color_name, screen_def_return, exact_def_return)
      Display *display;
      Colormap colormap;
      char *color_name;
      XColor *screen_def_return, *exact_def_return;

Arguments

display Specifies the connection to the X server.
colormap Specifies the colormap.
color_name Specifies the color name string (for example, red) whose color definition structure you want returned.
screen_def_return Returns the closest RGB values provided by the hardware.
exact_def_return Returns the exact RGB values.

Description

The XAllocNamedColor() function looks up the named color with respect to the screen that is associated with the specified colormap. It returns both the exact database definition and the closest color supported by the screen. The allocated color cell is read-only. The pixel value is returned in screen_def_return. If the color name is not in the Host Portable Character Encoding, the result is implementation dependent. Use of uppercase or lowercase does not matter. If screen_def_return and exact_def_return point to the same structure, the pixel field will be set correctly but the color values are undefined. XAllocNamedColor() returns nonzero if a cell is allocated; otherwise, it returns zero.

XAllocNamedColor() can generate a BadColor error.

Diagnostics

BadColor A value for a Colormap argument does not name a defined Colormap.

See also

XAllocColor(), XAllocColorCells(), XAllocColorPlanes(), XCreateColormap(), XFreeColors(), XQueryColor(), XStoreColors(), "Allocating and Freeing Color Cells".
Christophe Tronche, [email protected]