Next: , Previous: , Up: Colormap Functions   [Contents][Index]

10.3.4 Finding Colors

A CLX program can ask the X server to return the colors stored in allocated color cells. The server also maintains a dictionary of color names and their associated color values. CLX provides a function to look up the values for common colors by names such as "red", "purple", and so forth. The following paragraphs describe the CLX functions for returning the color values associated with color cells or with color names.

Function: lookup-color colormap name

A colormap.


A stringable color name.

Returns the color associated by the X server with the given color name. The name must contain only ISO Latin-1 characters; case is not significant. The first value returned is the closest approximation to the requested color possible on the screen hardware. The second value returned is the true color value for the requested color.


Type color.

Function: query-colors colormap pixels &key (:result-type 'list)

A colormap.


A sequence of pixel values.


A subtype of sequence that indicates the type of sequences returned.

Returns a sequence of the colors contained in the allocated cells of the colormap specified by the given pixels. The values returned for unallocated cells are undefined.


Type sequence of color.