XStoreNamedColor(display, colormap, color, pixel, flags)
      Display *display;
      Colormap colormap;
      char *color;
      unsigned long pixel;
      int flags;


display Specifies the connection to the X server.
colormap Specifies the colormap.
color Specifies the color name string (for example, red).
pixel Specifies the entry in the colormap.
flags Specifies which red, green, and blue components are set.


The XStoreNamedColor() function looks up the named color with respect to the screen associated with the colormap and stores the result in the specified colormap. The pixel argument determines the entry in the colormap. The flags argument determines which of the red, green, and blue components are set. You can set this member to the bitwise inclusive OR of the bits DoRed, DoGreen, and DoBlue. 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 the specified pixel is not a valid index into the colormap, a BadValue error results. If the specified pixel either is unallocated or is allocated read-only, a BadAccess error results.

XStoreNamedColor() can generate BadAccess, BadColor, BadName, and BadValue errors.


BadAccess A client attempted to free a color map entry that it did not already allocate.
BadAccess A client attempted to store into a read-only color map entry.
BadColor A value for a Colormap argument does not name a defined Colormap.
BadName A font or color of the specified name does not exist.
BadValue Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error.

See also

XAllocColor(), XCreateColormap(), XQueryColor(), XStoreColor(), XStoreColors(), "Modifying and Querying Colormap Cells".
Christophe Tronche, ch@tronche.com