1XQueryColor(3) XLIB FUNCTIONS XQueryColor(3)
2
3
4
6 XQueryColor, XQueryColors, XLookupColor, XParseColor - obtain color
7 values
8
10 int XQueryColor(Display *display, Colormap colormap, XColor
11 *def_in_out);
12
13 int XQueryColors(Display *display, Colormap colormap, XColor
14 defs_in_out[], int ncolors);
15
16 Status XLookupColor(Display *display, Colormap colormap, _Xconst char
17 *color_name, XColor *exact_def_return, XColor *screen_def_re‐
18 turn);
19
20 Status XParseColor(Display *display, Colormap colormap, _Xconst char
21 *spec, XColor *exact_def_return);
22
24 colormap Specifies the colormap.
25
26 color_name
27 Specifies the color name string (for example, red) whose
28 color definition structure you want returned.
29
30 def_in_out
31 Specifies and returns the RGB values for the pixel specified
32 in the structure.
33
34 defs_in_out
35 Specifies and returns an array of color definition structures
36 for the pixel specified in the structure.
37
38 display Specifies the connection to the X server.
39
40 exact_def_return
41 Returns the exact RGB values.
42
43 ncolors Specifies the number of XColor structures in the color defi‐
44 nition array.
45
46 screen_def_return
47 Returns the closest RGB values provided by the hardware.
48
49 spec Specifies the color name string; case is ignored.
50
51 exact_def_return
52 Returns the exact color value for later use and sets the
53 DoRed, DoGreen, and DoBlue flags.
54
56 The XQueryColor function returns the current RGB value for the pixel in
57 the XColor structure and sets the DoRed, DoGreen, and DoBlue flags.
58 The XQueryColors function returns the RGB value for each pixel in each
59 XColor structure and sets the DoRed, DoGreen, and DoBlue flags in each
60 structure.
61
62
63 XQueryColor and XQueryColors can generate BadColor and BadValue errors.
64
65 The XLookupColor function looks up the string name of a color with re‐
66 spect to the screen associated with the specified colormap. It returns
67 both the exact color values and the closest values provided by the
68 screen with respect to the visual type of the specified colormap. If
69 the color name is not in the Host Portable Character Encoding, the re‐
70 sult is implementation-dependent. Use of uppercase or lowercase does
71 not matter. XLookupColor returns nonzero if the name is resolved; oth‐
72 erwise, it returns zero.
73
74 The XParseColor function looks up the string name of a color with re‐
75 spect to the screen associated with the specified colormap. It returns
76 the exact color value. If the color name is not in the Host Portable
77 Character Encoding, the result is implementation-dependent. Use of up‐
78 percase or lowercase does not matter. XParseColor returns nonzero if
79 the name is resolved; otherwise, it returns zero.
80
81 XLookupColor and XParseColor can generate BadColor error.
82
84 An RGB Device specification is identified by the prefix “rgb:” and con‐
85 forms to the following syntax:
86
87 rgb:<red>/<green>/<blue>
88
89 <red>, <green>, <blue> := h | hh | hhh | hhhh
90 h := single hexadecimal digits (case insignificant)
91
92 Note that h indicates the value scaled in 4 bits, hh the value scaled
93 in 8 bits, hhh the value scaled in 12 bits, and hhhh the value scaled
94 in 16 bits, respectively.
95
96 For backward compatibility, an older syntax for RGB Device is sup‐
97 ported, but its continued use is not encouraged. The syntax is an ini‐
98 tial sharp sign character followed by a numeric specification, in one
99 of the following formats:
100
101 #RGB (4 bits each)
102 #RRGGBB (8 bits each)
103 #RRRGGGBBB (12 bits each)
104 #RRRRGGGGBBBB (16 bits each)
105
106 The R, G, and B represent single hexadecimal digits. When fewer than
107 16 bits each are specified, they represent the most significant bits of
108 the value (unlike the “rgb:” syntax, in which values are scaled). For
109 example, the string “#3a7” is the same as “#3000a0007000”.
110
111 An RGB intensity specification is identified by the prefix “rgbi:” and
112 conforms to the following syntax:
113
114 rgbi:<red>/<green>/<blue>
115
116 Note that red, green, and blue are floating-point values between 0.0
117 and 1.0, inclusive. The input format for these values is an optional
118 sign, a string of numbers possibly containing a decimal point, and an
119 optional exponent field containing an E or e followed by a possibly
120 signed integer string.
121
122 The standard device-independent string specifications have the follow‐
123 ing syntax:
124
125 CIEXYZ:<X>/<Y>/<Z>
126 CIEuvY:<u>/<v>/<Y>
127 CIExyY:<x>/<y>/<Y>
128 CIELab:<L>/<a>/<b>
129 CIELuv:<L>/<u>/<v>
130 TekHVC:<H>/<V>/<C>
131
132 All of the values (C, H, V, X, Y, Z, a, b, u, v, y, x) are floating-
133 point values. The syntax for these values is an optional plus or minus
134 sign, a string of digits possibly containing a decimal point, and an
135 optional exponent field consisting of an “E” or “e” followed by an op‐
136 tional plus or minus followed by a string of digits.
137
139 BadColor A value for a Colormap argument does not name a defined Col‐
140 ormap.
141
142 BadValue Some numeric value falls outside the range of values accepted
143 by the request. Unless a specific range is specified for an
144 argument, the full range defined by the argument's type is
145 accepted. Any argument defined as a set of alternatives can
146 generate this error.
147
149 XAllocColor(3), XCreateColormap(3), XStoreColors(3)
150 Xlib - C Language X Interface
151
152
153
154X Version 11 libX11 1.7.3.1 XQueryColor(3)