NAME

XQueryColor, XQueryColors, XLookupColor, XParseColor - obtain color values

SYNTAX

int XQueryColor(Display *_d_i_s_p_l_a_y, Colormap _c_o_l_o_r_m_a_p, XColor *_d_e_f___i_n___o_u_t); int XQueryColors(Display *_d_i_s_p_l_a_y, Colormap _c_o_l_o_r_m_a_p, XColor _d_e_f_s___i_n___o_u_t[], int _n_c_o_l_o_r_s); Status XLookupColor(Display *_d_i_s_p_l_a_y, Colormap _c_o_l_o_r_m_a_p, char *_c_o_l_o_r___n_a_m_e, XColor *_e_x_a_c_t___d_e_f___r_e_t_u_r_n, XColor *_s_c_r_e_e_n___d_e_f___r_e_t_u_r_n); Status XParseColor(Display *_d_i_s_p_l_a_y, Colormap _c_o_l_o_r_m_a_p, char *_s_p_e_c, XColor *_e_x_a_c_t___d_e_f___r_e_t_u_r_n);

ARGUMENTS

_c_o_l_o_r_m_a_p Specifies the colormap.
_c_o_l_o_r___n_a_m_e Specifies the color name string (for example, red) whose color
definition structure you want returned.
_d_e_f___i_n___o_u_t Specifies and returns the RGB values for the pixel specified in the structure.
_d_e_f_s___i_n___o_u_t Specifies and returns an array of color definition structures for the pixel
specified in the structure.
_d_i_s_p_l_a_y Specifies the connection to the X server.
_e_x_a_c_t___d_e_f___r_e_t_u_r_n Returns the exact RGB values.
_n_c_o_l_o_r_s Specifies the number of
_X_C_o_l_o_r structures in the color definition array.
_s_c_r_e_e_n___d_e_f___r_e_t_u_r_n Returns the closest RGB values provided by the hardware.
_s_p_e_c Specifies the color name string;
case is ignored.
_e_x_a_c_t___d_e_f___r_e_t_u_r_n Returns the exact color value for later use and sets the
_D_o_R_e_d, _D_o_G_r_e_e_n, and _D_o_B_l_u_e flags.

DESCRIPTION

The _X_Q_u_e_r_y_C_o_l_o_r function returns the current RGB value for the pixel in the _X_C_o_l_o_r structure and sets the _D_o_R_e_d, _D_o_G_r_e_e_n, and _D_o_B_l_u_e flags. The _X_Q_u_e_r_y_C_o_l_o_r_s function returns the RGB value for each pixel in each _X_C_o_l_o_r structure and sets the _D_o_R_e_d, _D_o_G_r_e_e_n, and _D_o_B_l_u_e flags in each structure.

_X_Q_u_e_r_y_C_o_l_o_r and _X_Q_u_e_r_y_C_o_l_o_r_s can generate _B_a_d_C_o_l_o_r and _B_a_d_V_a_l_u_e errors.

The _X_L_o_o_k_u_p_C_o_l_o_r function looks up the string name of a color with respect to the screen associated with the specified colormap. It returns both the exact color values and the closest values provided by the screen with respect to the visual type of the specified colormap. 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. _X_L_o_o_k_u_p_C_o_l_o_r returns nonzero if the name is resolved; otherwise, it returns zero.

The _X_P_a_r_s_e_C_o_l_o_r function looks up the string name of a color with respect to the screen associated with the specified colormap. It returns the exact color value. 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. _X_P_a_r_s_e_C_o_l_o_r returns nonzero if the name is resolved; otherwise, it returns zero.

_X_L_o_o_k_u_p_C_o_l_o_r and _X_P_a_r_s_e_C_o_l_o_r can generate _B_a_d_C_o_l_o_r error.

COLOR NAMES

An RGB Device specification is identified by the prefix ``rgb:'' and conforms to the following syntax:


rgb:_<_r_e_d_>_/_<_g_r_e_e_n_>_/_<_b_l_u_e_>

_<_r_e_d_>, _<_g_r_e_e_n_>, _<_b_l_u_e_> := _h | _h_h | _h_h_h | _h_h_h_h _h := single hexadecimal digits (case insignificant)

Note that _h indicates the value scaled in 4 bits, _h_h the value scaled in 8 bits, _h_h_h the value scaled in 12 bits, and _h_h_h_h the value scaled in 16 bits, respectively.

For backward compatibility, an older syntax for RGB Device is supported, but its continued use is not encouraged. The syntax is an initial sharp sign character followed by a numeric specification, in one of the following formats:

l l.
#RGB    (4 bits each)
#RRGGBB (8 bits each)
#RRRGGGBBB      (12 bits each)
#RRRRGGGGBBBB   (16 bits each)

The R, G, and B represent single hexadecimal digits. When fewer than 16 bits each are specified, they represent the most significant bits of the value (unlike the ``rgb:'' syntax, in which values are scaled). For example, the string ``#3a7'' is the same as ``#3000a0007000''.

An RGB intensity specification is identified by the prefix ``rgbi:'' and conforms to the following syntax:


rgbi:_<_r_e_d_>_/_<_g_r_e_e_n_>_/_<_b_l_u_e_>


Note that red, green, and blue are floating-point values between 0.0 and 1.0, inclusive. The input format for these values is an optional sign, a string of numbers possibly containing a decimal point, and an optional exponent field containing an E or e followed by a possibly signed integer string.

The standard device-independent string specifications have the following syntax:


CIEXYZ:_<_X_>_/_<_Y_>_/_<_Z_>
CIEuvY:_<_u_>_/_<_v_>_/_<_Y_>
CIExyY:_<_x_>_/_<_y_>_/_<_Y_>
CIELab:_<_L_>_/_<_a_>_/_<_b_>
CIELuv:_<_L_>_/_<_u_>_/_<_v_>
TekHVC:_<_H_>_/_<_V_>_/_<_C_>


All of the values (C, H, V, X, Y, Z, a, b, u, v, y, x) are floating-point values. The syntax for these values is an optional plus or minus sign, a string of digits possibly containing a decimal point, and an optional exponent field consisting of an ``E'' or ``e'' followed by an optional plus or minus followed by a string of digits.

DIAGNOSTICS

_B_a_d_C_o_l_o_r
A value for a Colormap argument does not name a defined Colormap.
_B_a_d_V_a_l_u_e
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(3X11), XCreateColormap(3X11), XStoreColors(3X11)
_X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e