1 |
/* $Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tk_base/xcolors.c,v 1.1.1.1 2001/06/13 05:15:39 dtashley Exp $ */
|
2 |
|
3 |
/*
|
4 |
* xcolors.c --
|
5 |
*
|
6 |
* This file contains the routines used to map from X color
|
7 |
* names to RGB and pixel values.
|
8 |
*
|
9 |
* Copyright (c) 1996 by Sun Microsystems, Inc.
|
10 |
*
|
11 |
* See the file "license.terms" for information on usage and redistribution
|
12 |
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
13 |
*
|
14 |
* RCS: @(#) $Id: xcolors.c,v 1.1.1.1 2001/06/13 05:15:39 dtashley Exp $
|
15 |
*/
|
16 |
|
17 |
#include "tkInt.h"
|
18 |
|
19 |
/*
|
20 |
* Define an array that defines the mapping from color names to RGB values.
|
21 |
* Note that this array must be kept sorted alphabetically so that the
|
22 |
* binary search used in XParseColor will succeed.
|
23 |
*/
|
24 |
|
25 |
typedef struct {
|
26 |
char *name;
|
27 |
unsigned char red;
|
28 |
unsigned char green;
|
29 |
unsigned char blue;
|
30 |
} XColorEntry;
|
31 |
|
32 |
static XColorEntry xColors[] = {
|
33 |
"alice blue", 240, 248, 255,
|
34 |
"AliceBlue", 240, 248, 255,
|
35 |
"antique white", 250, 235, 215,
|
36 |
"AntiqueWhite", 250, 235, 215,
|
37 |
"AntiqueWhite1", 255, 239, 219,
|
38 |
"AntiqueWhite2", 238, 223, 204,
|
39 |
"AntiqueWhite3", 205, 192, 176,
|
40 |
"AntiqueWhite4", 139, 131, 120,
|
41 |
"aquamarine", 127, 255, 212,
|
42 |
"aquamarine1", 127, 255, 212,
|
43 |
"aquamarine2", 118, 238, 198,
|
44 |
"aquamarine3", 102, 205, 170,
|
45 |
"aquamarine4", 69, 139, 116,
|
46 |
"azure", 240, 255, 255,
|
47 |
"azure1", 240, 255, 255,
|
48 |
"azure2", 224, 238, 238,
|
49 |
"azure3", 193, 205, 205,
|
50 |
"azure4", 131, 139, 139,
|
51 |
"beige", 245, 245, 220,
|
52 |
"bisque", 255, 228, 196,
|
53 |
"bisque1", 255, 228, 196,
|
54 |
"bisque2", 238, 213, 183,
|
55 |
"bisque3", 205, 183, 158,
|
56 |
"bisque4", 139, 125, 107,
|
57 |
"black", 0, 0, 0,
|
58 |
"blanched almond", 255, 235, 205,
|
59 |
"BlanchedAlmond", 255, 235, 205,
|
60 |
"blue", 0, 0, 255,
|
61 |
"blue violet", 138, 43, 226,
|
62 |
"blue1", 0, 0, 255,
|
63 |
"blue2", 0, 0, 238,
|
64 |
"blue3", 0, 0, 205,
|
65 |
"blue4", 0, 0, 139,
|
66 |
"BlueViolet", 138, 43, 226,
|
67 |
"brown", 165, 42, 42,
|
68 |
"brown1", 255, 64, 64,
|
69 |
"brown2", 238, 59, 59,
|
70 |
"brown3", 205, 51, 51,
|
71 |
"brown4", 139, 35, 35,
|
72 |
"burlywood", 222, 184, 135,
|
73 |
"burlywood1", 255, 211, 155,
|
74 |
"burlywood2", 238, 197, 145,
|
75 |
"burlywood3", 205, 170, 125,
|
76 |
"burlywood4", 139, 115, 85,
|
77 |
"cadet blue", 95, 158, 160,
|
78 |
"CadetBlue", 95, 158, 160,
|
79 |
"CadetBlue1", 152, 245, 255,
|
80 |
"CadetBlue2", 142, 229, 238,
|
81 |
"CadetBlue3", 122, 197, 205,
|
82 |
"CadetBlue4", 83, 134, 139,
|
83 |
"chartreuse", 127, 255, 0,
|
84 |
"chartreuse1", 127, 255, 0,
|
85 |
"chartreuse2", 118, 238, 0,
|
86 |
"chartreuse3", 102, 205, 0,
|
87 |
"chartreuse4", 69, 139, 0,
|
88 |
"chocolate", 210, 105, 30,
|
89 |
"chocolate1", 255, 127, 36,
|
90 |
"chocolate2", 238, 118, 33,
|
91 |
"chocolate3", 205, 102, 29,
|
92 |
"chocolate4", 139, 69, 19,
|
93 |
"coral", 255, 127, 80,
|
94 |
"coral1", 255, 114, 86,
|
95 |
"coral2", 238, 106, 80,
|
96 |
"coral3", 205, 91, 69,
|
97 |
"coral4", 139, 62, 47,
|
98 |
"cornflower blue", 100, 149, 237,
|
99 |
"CornflowerBlue", 100, 149, 237,
|
100 |
"cornsilk", 255, 248, 220,
|
101 |
"cornsilk1", 255, 248, 220,
|
102 |
"cornsilk2", 238, 232, 205,
|
103 |
"cornsilk3", 205, 200, 177,
|
104 |
"cornsilk4", 139, 136, 120,
|
105 |
"cyan", 0, 255, 255,
|
106 |
"cyan1", 0, 255, 255,
|
107 |
"cyan2", 0, 238, 238,
|
108 |
"cyan3", 0, 205, 205,
|
109 |
"cyan4", 0, 139, 139,
|
110 |
"dark blue", 0, 0, 139,
|
111 |
"dark cyan", 0, 139, 139,
|
112 |
"dark goldenrod", 184, 134, 11,
|
113 |
"dark gray", 169, 169, 169,
|
114 |
"dark green", 0, 100, 0,
|
115 |
"dark grey", 169, 169, 169,
|
116 |
"dark khaki", 189, 183, 107,
|
117 |
"dark magenta", 139, 0, 139,
|
118 |
"dark olive green", 85, 107, 47,
|
119 |
"dark orange", 255, 140, 0,
|
120 |
"dark orchid", 153, 50, 204,
|
121 |
"dark red", 139, 0, 0,
|
122 |
"dark salmon", 233, 150, 122,
|
123 |
"dark sea green", 143, 188, 143,
|
124 |
"dark slate blue", 72, 61, 139,
|
125 |
"dark slate gray", 47, 79, 79,
|
126 |
"dark slate grey", 47, 79, 79,
|
127 |
"dark turquoise", 0, 206, 209,
|
128 |
"dark violet", 148, 0, 211,
|
129 |
"DarkBlue", 0, 0, 139,
|
130 |
"DarkCyan", 0, 139, 139,
|
131 |
"DarkGoldenrod", 184, 134, 11,
|
132 |
"DarkGoldenrod1", 255, 185, 15,
|
133 |
"DarkGoldenrod2", 238, 173, 14,
|
134 |
"DarkGoldenrod3", 205, 149, 12,
|
135 |
"DarkGoldenrod4", 139, 101, 8,
|
136 |
"DarkGray", 169, 169, 169,
|
137 |
"DarkGreen", 0, 100, 0,
|
138 |
"DarkGrey", 169, 169, 169,
|
139 |
"DarkKhaki", 189, 183, 107,
|
140 |
"DarkMagenta", 139, 0, 139,
|
141 |
"DarkOliveGreen", 85, 107, 47,
|
142 |
"DarkOliveGreen1", 202, 255, 112,
|
143 |
"DarkOliveGreen2", 188, 238, 104,
|
144 |
"DarkOliveGreen3", 162, 205, 90,
|
145 |
"DarkOliveGreen4", 110, 139, 61,
|
146 |
"DarkOrange", 255, 140, 0,
|
147 |
"DarkOrange1", 255, 127, 0,
|
148 |
"DarkOrange2", 238, 118, 0,
|
149 |
"DarkOrange3", 205, 102, 0,
|
150 |
"DarkOrange4", 139, 69, 0,
|
151 |
"DarkOrchid", 153, 50, 204,
|
152 |
"DarkOrchid1", 191, 62, 255,
|
153 |
"DarkOrchid2", 178, 58, 238,
|
154 |
"DarkOrchid3", 154, 50, 205,
|
155 |
"DarkOrchid4", 104, 34, 139,
|
156 |
"DarkRed", 139, 0, 0,
|
157 |
"DarkSalmon", 233, 150, 122,
|
158 |
"DarkSeaGreen", 143, 188, 143,
|
159 |
"DarkSeaGreen1", 193, 255, 193,
|
160 |
"DarkSeaGreen2", 180, 238, 180,
|
161 |
"DarkSeaGreen3", 155, 205, 155,
|
162 |
"DarkSeaGreen4", 105, 139, 105,
|
163 |
"DarkSlateBlue", 72, 61, 139,
|
164 |
"DarkSlateGray", 47, 79, 79,
|
165 |
"DarkSlateGray1", 151, 255, 255,
|
166 |
"DarkSlateGray2", 141, 238, 238,
|
167 |
"DarkSlateGray3", 121, 205, 205,
|
168 |
"DarkSlateGray4", 82, 139, 139,
|
169 |
"DarkSlateGrey", 47, 79, 79,
|
170 |
"DarkTurquoise", 0, 206, 209,
|
171 |
"DarkViolet", 148, 0, 211,
|
172 |
"deep pink", 255, 20, 147,
|
173 |
"deep sky blue", 0, 191, 255,
|
174 |
"DeepPink", 255, 20, 147,
|
175 |
"DeepPink1", 255, 20, 147,
|
176 |
"DeepPink2", 238, 18, 137,
|
177 |
"DeepPink3", 205, 16, 118,
|
178 |
"DeepPink4", 139, 10, 80,
|
179 |
"DeepSkyBlue", 0, 191, 255,
|
180 |
"DeepSkyBlue1", 0, 191, 255,
|
181 |
"DeepSkyBlue2", 0, 178, 238,
|
182 |
"DeepSkyBlue3", 0, 154, 205,
|
183 |
"DeepSkyBlue4", 0, 104, 139,
|
184 |
"dim gray", 105, 105, 105,
|
185 |
"dim grey", 105, 105, 105,
|
186 |
"DimGray", 105, 105, 105,
|
187 |
"DimGrey", 105, 105, 105,
|
188 |
"dodger blue", 30, 144, 255,
|
189 |
"DodgerBlue", 30, 144, 255,
|
190 |
"DodgerBlue1", 30, 144, 255,
|
191 |
"DodgerBlue2", 28, 134, 238,
|
192 |
"DodgerBlue3", 24, 116, 205,
|
193 |
"DodgerBlue4", 16, 78, 139,
|
194 |
"firebrick", 178, 34, 34,
|
195 |
"firebrick1", 255, 48, 48,
|
196 |
"firebrick2", 238, 44, 44,
|
197 |
"firebrick3", 205, 38, 38,
|
198 |
"firebrick4", 139, 26, 26,
|
199 |
"floral white", 255, 250, 240,
|
200 |
"FloralWhite", 255, 250, 240,
|
201 |
"forest green", 34, 139, 34,
|
202 |
"ForestGreen", 34, 139, 34,
|
203 |
"gainsboro", 220, 220, 220,
|
204 |
"ghost white", 248, 248, 255,
|
205 |
"GhostWhite", 248, 248, 255,
|
206 |
"gold", 255, 215, 0,
|
207 |
"gold1", 255, 215, 0,
|
208 |
"gold2", 238, 201, 0,
|
209 |
"gold3", 205, 173, 0,
|
210 |
"gold4", 139, 117, 0,
|
211 |
"goldenrod", 218, 165, 32,
|
212 |
"goldenrod1", 255, 193, 37,
|
213 |
"goldenrod2", 238, 180, 34,
|
214 |
"goldenrod3", 205, 155, 29,
|
215 |
"goldenrod4", 139, 105, 20,
|
216 |
"gray", 190, 190, 190,
|
217 |
"gray0", 0, 0, 0,
|
218 |
"gray1", 3, 3, 3,
|
219 |
"gray10", 26, 26, 26,
|
220 |
"gray100", 255, 255, 255,
|
221 |
"gray11", 28, 28, 28,
|
222 |
"gray12", 31, 31, 31,
|
223 |
"gray13", 33, 33, 33,
|
224 |
"gray14", 36, 36, 36,
|
225 |
"gray15", 38, 38, 38,
|
226 |
"gray16", 41, 41, 41,
|
227 |
"gray17", 43, 43, 43,
|
228 |
"gray18", 46, 46, 46,
|
229 |
"gray19", 48, 48, 48,
|
230 |
"gray2", 5, 5, 5,
|
231 |
"gray20", 51, 51, 51,
|
232 |
"gray21", 54, 54, 54,
|
233 |
"gray22", 56, 56, 56,
|
234 |
"gray23", 59, 59, 59,
|
235 |
"gray24", 61, 61, 61,
|
236 |
"gray25", 64, 64, 64,
|
237 |
"gray26", 66, 66, 66,
|
238 |
"gray27", 69, 69, 69,
|
239 |
"gray28", 71, 71, 71,
|
240 |
"gray29", 74, 74, 74,
|
241 |
"gray3", 8, 8, 8,
|
242 |
"gray30", 77, 77, 77,
|
243 |
"gray31", 79, 79, 79,
|
244 |
"gray32", 82, 82, 82,
|
245 |
"gray33", 84, 84, 84,
|
246 |
"gray34", 87, 87, 87,
|
247 |
"gray35", 89, 89, 89,
|
248 |
"gray36", 92, 92, 92,
|
249 |
"gray37", 94, 94, 94,
|
250 |
"gray38", 97, 97, 97,
|
251 |
"gray39", 99, 99, 99,
|
252 |
"gray4", 10, 10, 10,
|
253 |
"gray40", 102, 102, 102,
|
254 |
"gray41", 105, 105, 105,
|
255 |
"gray42", 107, 107, 107,
|
256 |
"gray43", 110, 110, 110,
|
257 |
"gray44", 112, 112, 112,
|
258 |
"gray45", 115, 115, 115,
|
259 |
"gray46", 117, 117, 117,
|
260 |
"gray47", 120, 120, 120,
|
261 |
"gray48", 122, 122, 122,
|
262 |
"gray49", 125, 125, 125,
|
263 |
"gray5", 13, 13, 13,
|
264 |
"gray50", 127, 127, 127,
|
265 |
"gray51", 130, 130, 130,
|
266 |
"gray52", 133, 133, 133,
|
267 |
"gray53", 135, 135, 135,
|
268 |
"gray54", 138, 138, 138,
|
269 |
"gray55", 140, 140, 140,
|
270 |
"gray56", 143, 143, 143,
|
271 |
"gray57", 145, 145, 145,
|
272 |
"gray58", 148, 148, 148,
|
273 |
"gray59", 150, 150, 150,
|
274 |
"gray6", 15, 15, 15,
|
275 |
"gray60", 153, 153, 153,
|
276 |
"gray61", 156, 156, 156,
|
277 |
"gray62", 158, 158, 158,
|
278 |
"gray63", 161, 161, 161,
|
279 |
"gray64", 163, 163, 163,
|
280 |
"gray65", 166, 166, 166,
|
281 |
"gray66", 168, 168, 168,
|
282 |
"gray67", 171, 171, 171,
|
283 |
"gray68", 173, 173, 173,
|
284 |
"gray69", 176, 176, 176,
|
285 |
"gray7", 18, 18, 18,
|
286 |
"gray70", 179, 179, 179,
|
287 |
"gray71", 181, 181, 181,
|
288 |
"gray72", 184, 184, 184,
|
289 |
"gray73", 186, 186, 186,
|
290 |
"gray74", 189, 189, 189,
|
291 |
"gray75", 191, 191, 191,
|
292 |
"gray76", 194, 194, 194,
|
293 |
"gray77", 196, 196, 196,
|
294 |
"gray78", 199, 199, 199,
|
295 |
"gray79", 201, 201, 201,
|
296 |
"gray8", 20, 20, 20,
|
297 |
"gray80", 204, 204, 204,
|
298 |
"gray81", 207, 207, 207,
|
299 |
"gray82", 209, 209, 209,
|
300 |
"gray83", 212, 212, 212,
|
301 |
"gray84", 214, 214, 214,
|
302 |
"gray85", 217, 217, 217,
|
303 |
"gray86", 219, 219, 219,
|
304 |
"gray87", 222, 222, 222,
|
305 |
"gray88", 224, 224, 224,
|
306 |
"gray89", 227, 227, 227,
|
307 |
"gray9", 23, 23, 23,
|
308 |
"gray90", 229, 229, 229,
|
309 |
"gray91", 232, 232, 232,
|
310 |
"gray92", 235, 235, 235,
|
311 |
"gray93", 237, 237, 237,
|
312 |
"gray94", 240, 240, 240,
|
313 |
"gray95", 242, 242, 242,
|
314 |
"gray96", 245, 245, 245,
|
315 |
"gray97", 247, 247, 247,
|
316 |
"gray98", 250, 250, 250,
|
317 |
"gray99", 252, 252, 252,
|
318 |
"green", 0, 255, 0,
|
319 |
"green yellow", 173, 255, 47,
|
320 |
"green1", 0, 255, 0,
|
321 |
"green2", 0, 238, 0,
|
322 |
"green3", 0, 205, 0,
|
323 |
"green4", 0, 139, 0,
|
324 |
"GreenYellow", 173, 255, 47,
|
325 |
"grey", 190, 190, 190,
|
326 |
"grey0", 0, 0, 0,
|
327 |
"grey1", 3, 3, 3,
|
328 |
"grey10", 26, 26, 26,
|
329 |
"grey100", 255, 255, 255,
|
330 |
"grey11", 28, 28, 28,
|
331 |
"grey12", 31, 31, 31,
|
332 |
"grey13", 33, 33, 33,
|
333 |
"grey14", 36, 36, 36,
|
334 |
"grey15", 38, 38, 38,
|
335 |
"grey16", 41, 41, 41,
|
336 |
"grey17", 43, 43, 43,
|
337 |
"grey18", 46, 46, 46,
|
338 |
"grey19", 48, 48, 48,
|
339 |
"grey2", 5, 5, 5,
|
340 |
"grey20", 51, 51, 51,
|
341 |
"grey21", 54, 54, 54,
|
342 |
"grey22", 56, 56, 56,
|
343 |
"grey23", 59, 59, 59,
|
344 |
"grey24", 61, 61, 61,
|
345 |
"grey25", 64, 64, 64,
|
346 |
"grey26", 66, 66, 66,
|
347 |
"grey27", 69, 69, 69,
|
348 |
"grey28", 71, 71, 71,
|
349 |
"grey29", 74, 74, 74,
|
350 |
"grey3", 8, 8, 8,
|
351 |
"grey30", 77, 77, 77,
|
352 |
"grey31", 79, 79, 79,
|
353 |
"grey32", 82, 82, 82,
|
354 |
"grey33", 84, 84, 84,
|
355 |
"grey34", 87, 87, 87,
|
356 |
"grey35", 89, 89, 89,
|
357 |
"grey36", 92, 92, 92,
|
358 |
"grey37", 94, 94, 94,
|
359 |
"grey38", 97, 97, 97,
|
360 |
"grey39", 99, 99, 99,
|
361 |
"grey4", 10, 10, 10,
|
362 |
"grey40", 102, 102, 102,
|
363 |
"grey41", 105, 105, 105,
|
364 |
"grey42", 107, 107, 107,
|
365 |
"grey43", 110, 110, 110,
|
366 |
"grey44", 112, 112, 112,
|
367 |
"grey45", 115, 115, 115,
|
368 |
"grey46", 117, 117, 117,
|
369 |
"grey47", 120, 120, 120,
|
370 |
"grey48", 122, 122, 122,
|
371 |
"grey49", 125, 125, 125,
|
372 |
"grey5", 13, 13, 13,
|
373 |
"grey50", 127, 127, 127,
|
374 |
"grey51", 130, 130, 130,
|
375 |
"grey52", 133, 133, 133,
|
376 |
"grey53", 135, 135, 135,
|
377 |
"grey54", 138, 138, 138,
|
378 |
"grey55", 140, 140, 140,
|
379 |
"grey56", 143, 143, 143,
|
380 |
"grey57", 145, 145, 145,
|
381 |
"grey58", 148, 148, 148,
|
382 |
"grey59", 150, 150, 150,
|
383 |
"grey6", 15, 15, 15,
|
384 |
"grey60", 153, 153, 153,
|
385 |
"grey61", 156, 156, 156,
|
386 |
"grey62", 158, 158, 158,
|
387 |
"grey63", 161, 161, 161,
|
388 |
"grey64", 163, 163, 163,
|
389 |
"grey65", 166, 166, 166,
|
390 |
"grey66", 168, 168, 168,
|
391 |
"grey67", 171, 171, 171,
|
392 |
"grey68", 173, 173, 173,
|
393 |
"grey69", 176, 176, 176,
|
394 |
"grey7", 18, 18, 18,
|
395 |
"grey70", 179, 179, 179,
|
396 |
"grey71", 181, 181, 181,
|
397 |
"grey72", 184, 184, 184,
|
398 |
"grey73", 186, 186, 186,
|
399 |
"grey74", 189, 189, 189,
|
400 |
"grey75", 191, 191, 191,
|
401 |
"grey76", 194, 194, 194,
|
402 |
"grey77", 196, 196, 196,
|
403 |
"grey78", 199, 199, 199,
|
404 |
"grey79", 201, 201, 201,
|
405 |
"grey8", 20, 20, 20,
|
406 |
"grey80", 204, 204, 204,
|
407 |
"grey81", 207, 207, 207,
|
408 |
"grey82", 209, 209, 209,
|
409 |
"grey83", 212, 212, 212,
|
410 |
"grey84", 214, 214, 214,
|
411 |
"grey85", 217, 217, 217,
|
412 |
"grey86", 219, 219, 219,
|
413 |
"grey87", 222, 222, 222,
|
414 |
"grey88", 224, 224, 224,
|
415 |
"grey89", 227, 227, 227,
|
416 |
"grey9", 23, 23, 23,
|
417 |
"grey90", 229, 229, 229,
|
418 |
"grey91", 232, 232, 232,
|
419 |
"grey92", 235, 235, 235,
|
420 |
"grey93", 237, 237, 237,
|
421 |
"grey94", 240, 240, 240,
|
422 |
"grey95", 242, 242, 242,
|
423 |
"grey96", 245, 245, 245,
|
424 |
"grey97", 247, 247, 247,
|
425 |
"grey98", 250, 250, 250,
|
426 |
"grey99", 252, 252, 252,
|
427 |
"honeydew", 240, 255, 240,
|
428 |
"honeydew1", 240, 255, 240,
|
429 |
"honeydew2", 224, 238, 224,
|
430 |
"honeydew3", 193, 205, 193,
|
431 |
"honeydew4", 131, 139, 131,
|
432 |
"hot pink", 255, 105, 180,
|
433 |
"HotPink", 255, 105, 180,
|
434 |
"HotPink1", 255, 110, 180,
|
435 |
"HotPink2", 238, 106, 167,
|
436 |
"HotPink3", 205, 96, 144,
|
437 |
"HotPink4", 139, 58, 98,
|
438 |
"indian red", 205, 92, 92,
|
439 |
"IndianRed", 205, 92, 92,
|
440 |
"IndianRed1", 255, 106, 106,
|
441 |
"IndianRed2", 238, 99, 99,
|
442 |
"IndianRed3", 205, 85, 85,
|
443 |
"IndianRed4", 139, 58, 58,
|
444 |
"ivory", 255, 255, 240,
|
445 |
"ivory1", 255, 255, 240,
|
446 |
"ivory2", 238, 238, 224,
|
447 |
"ivory3", 205, 205, 193,
|
448 |
"ivory4", 139, 139, 131,
|
449 |
"khaki", 240, 230, 140,
|
450 |
"khaki1", 255, 246, 143,
|
451 |
"khaki2", 238, 230, 133,
|
452 |
"khaki3", 205, 198, 115,
|
453 |
"khaki4", 139, 134, 78,
|
454 |
"lavender", 230, 230, 250,
|
455 |
"lavender blush", 255, 240, 245,
|
456 |
"LavenderBlush", 255, 240, 245,
|
457 |
"LavenderBlush1", 255, 240, 245,
|
458 |
"LavenderBlush2", 238, 224, 229,
|
459 |
"LavenderBlush3", 205, 193, 197,
|
460 |
"LavenderBlush4", 139, 131, 134,
|
461 |
"lawn green", 124, 252, 0,
|
462 |
"LawnGreen", 124, 252, 0,
|
463 |
"lemon chiffon", 255, 250, 205,
|
464 |
"LemonChiffon", 255, 250, 205,
|
465 |
"LemonChiffon1", 255, 250, 205,
|
466 |
"LemonChiffon2", 238, 233, 191,
|
467 |
"LemonChiffon3", 205, 201, 165,
|
468 |
"LemonChiffon4", 139, 137, 112,
|
469 |
"light blue", 173, 216, 230,
|
470 |
"light coral", 240, 128, 128,
|
471 |
"light cyan", 224, 255, 255,
|
472 |
"light goldenrod", 238, 221, 130,
|
473 |
"light goldenrod yellow", 250, 250, 210,
|
474 |
"light gray", 211, 211, 211,
|
475 |
"light green", 144, 238, 144,
|
476 |
"light grey", 211, 211, 211,
|
477 |
"light pink", 255, 182, 193,
|
478 |
"light salmon", 255, 160, 122,
|
479 |
"light sea green", 32, 178, 170,
|
480 |
"light sky blue", 135, 206, 250,
|
481 |
"light slate blue", 132, 112, 255,
|
482 |
"light slate gray", 119, 136, 153,
|
483 |
"light slate grey", 119, 136, 153,
|
484 |
"light steel blue", 176, 196, 222,
|
485 |
"light yellow", 255, 255, 224,
|
486 |
"LightBlue", 173, 216, 230,
|
487 |
"LightBlue1", 191, 239, 255,
|
488 |
"LightBlue2", 178, 223, 238,
|
489 |
"LightBlue3", 154, 192, 205,
|
490 |
"LightBlue4", 104, 131, 139,
|
491 |
"LightCoral", 240, 128, 128,
|
492 |
"LightCyan", 224, 255, 255,
|
493 |
"LightCyan1", 224, 255, 255,
|
494 |
"LightCyan2", 209, 238, 238,
|
495 |
"LightCyan3", 180, 205, 205,
|
496 |
"LightCyan4", 122, 139, 139,
|
497 |
"LightGoldenrod", 238, 221, 130,
|
498 |
"LightGoldenrod1", 255, 236, 139,
|
499 |
"LightGoldenrod2", 238, 220, 130,
|
500 |
"LightGoldenrod3", 205, 190, 112,
|
501 |
"LightGoldenrod4", 139, 129, 76,
|
502 |
"LightGoldenrodYellow", 250, 250, 210,
|
503 |
"LightGray", 211, 211, 211,
|
504 |
"LightGreen", 144, 238, 144,
|
505 |
"LightGrey", 211, 211, 211,
|
506 |
"LightPink", 255, 182, 193,
|
507 |
"LightPink1", 255, 174, 185,
|
508 |
"LightPink2", 238, 162, 173,
|
509 |
"LightPink3", 205, 140, 149,
|
510 |
"LightPink4", 139, 95, 101,
|
511 |
"LightSalmon", 255, 160, 122,
|
512 |
"LightSalmon1", 255, 160, 122,
|
513 |
"LightSalmon2", 238, 149, 114,
|
514 |
"LightSalmon3", 205, 129, 98,
|
515 |
"LightSalmon4", 139, 87, 66,
|
516 |
"LightSeaGreen", 32, 178, 170,
|
517 |
"LightSkyBlue", 135, 206, 250,
|
518 |
"LightSkyBlue1", 176, 226, 255,
|
519 |
"LightSkyBlue2", 164, 211, 238,
|
520 |
"LightSkyBlue3", 141, 182, 205,
|
521 |
"LightSkyBlue4", 96, 123, 139,
|
522 |
"LightSlateBlue", 132, 112, 255,
|
523 |
"LightSlateGray", 119, 136, 153,
|
524 |
"LightSlateGrey", 119, 136, 153,
|
525 |
"LightSteelBlue", 176, 196, 222,
|
526 |
"LightSteelBlue1", 202, 225, 255,
|
527 |
"LightSteelBlue2", 188, 210, 238,
|
528 |
"LightSteelBlue3", 162, 181, 205,
|
529 |
"LightSteelBlue4", 110, 123, 139,
|
530 |
"LightYellow", 255, 255, 224,
|
531 |
"LightYellow1", 255, 255, 224,
|
532 |
"LightYellow2", 238, 238, 209,
|
533 |
"LightYellow3", 205, 205, 180,
|
534 |
"LightYellow4", 139, 139, 122,
|
535 |
"lime green", 50, 205, 50,
|
536 |
"LimeGreen", 50, 205, 50,
|
537 |
"linen", 250, 240, 230,
|
538 |
"magenta", 255, 0, 255,
|
539 |
"magenta1", 255, 0, 255,
|
540 |
"magenta2", 238, 0, 238,
|
541 |
"magenta3", 205, 0, 205,
|
542 |
"magenta4", 139, 0, 139,
|
543 |
"maroon", 176, 48, 96,
|
544 |
"maroon1", 255, 52, 179,
|
545 |
"maroon2", 238, 48, 167,
|
546 |
"maroon3", 205, 41, 144,
|
547 |
"maroon4", 139, 28, 98,
|
548 |
"medium aquamarine", 102, 205, 170,
|
549 |
"medium blue", 0, 0, 205,
|
550 |
"medium orchid", 186, 85, 211,
|
551 |
"medium purple", 147, 112, 219,
|
552 |
"medium sea green", 60, 179, 113,
|
553 |
"medium slate blue", 123, 104, 238,
|
554 |
"medium spring green", 0, 250, 154,
|
555 |
"medium turquoise", 72, 209, 204,
|
556 |
"medium violet red", 199, 21, 133,
|
557 |
"MediumAquamarine", 102, 205, 170,
|
558 |
"MediumBlue", 0, 0, 205,
|
559 |
"MediumOrchid", 186, 85, 211,
|
560 |
"MediumOrchid1", 224, 102, 255,
|
561 |
"MediumOrchid2", 209, 95, 238,
|
562 |
"MediumOrchid3", 180, 82, 205,
|
563 |
"MediumOrchid4", 122, 55, 139,
|
564 |
"MediumPurple", 147, 112, 219,
|
565 |
"MediumPurple1", 171, 130, 255,
|
566 |
"MediumPurple2", 159, 121, 238,
|
567 |
"MediumPurple3", 137, 104, 205,
|
568 |
"MediumPurple4", 93, 71, 139,
|
569 |
"MediumSeaGreen", 60, 179, 113,
|
570 |
"MediumSlateBlue", 123, 104, 238,
|
571 |
"MediumSpringGreen", 0, 250, 154,
|
572 |
"MediumTurquoise", 72, 209, 204,
|
573 |
"MediumVioletRed", 199, 21, 133,
|
574 |
"midnight blue", 25, 25, 112,
|
575 |
"MidnightBlue", 25, 25, 112,
|
576 |
"mint cream", 245, 255, 250,
|
577 |
"MintCream", 245, 255, 250,
|
578 |
"misty rose", 255, 228, 225,
|
579 |
"MistyRose", 255, 228, 225,
|
580 |
"MistyRose1", 255, 228, 225,
|
581 |
"MistyRose2", 238, 213, 210,
|
582 |
"MistyRose3", 205, 183, 181,
|
583 |
"MistyRose4", 139, 125, 123,
|
584 |
"moccasin", 255, 228, 181,
|
585 |
"navajo white", 255, 222, 173,
|
586 |
"NavajoWhite", 255, 222, 173,
|
587 |
"NavajoWhite1", 255, 222, 173,
|
588 |
"NavajoWhite2", 238, 207, 161,
|
589 |
"NavajoWhite3", 205, 179, 139,
|
590 |
"NavajoWhite4", 139, 121, 94,
|
591 |
"navy", 0, 0, 128,
|
592 |
"navy blue", 0, 0, 128,
|
593 |
"NavyBlue", 0, 0, 128,
|
594 |
"old lace", 253, 245, 230,
|
595 |
"OldLace", 253, 245, 230,
|
596 |
"olive drab", 107, 142, 35,
|
597 |
"OliveDrab", 107, 142, 35,
|
598 |
"OliveDrab1", 192, 255, 62,
|
599 |
"OliveDrab2", 179, 238, 58,
|
600 |
"OliveDrab3", 154, 205, 50,
|
601 |
"OliveDrab4", 105, 139, 34,
|
602 |
"orange", 255, 165, 0,
|
603 |
"orange red", 255, 69, 0,
|
604 |
"orange1", 255, 165, 0,
|
605 |
"orange2", 238, 154, 0,
|
606 |
"orange3", 205, 133, 0,
|
607 |
"orange4", 139, 90, 0,
|
608 |
"OrangeRed", 255, 69, 0,
|
609 |
"OrangeRed1", 255, 69, 0,
|
610 |
"OrangeRed2", 238, 64, 0,
|
611 |
"OrangeRed3", 205, 55, 0,
|
612 |
"OrangeRed4", 139, 37, 0,
|
613 |
"orchid", 218, 112, 214,
|
614 |
"orchid1", 255, 131, 250,
|
615 |
"orchid2", 238, 122, 233,
|
616 |
"orchid3", 205, 105, 201,
|
617 |
"orchid4", 139, 71, 137,
|
618 |
"pale goldenrod", 238, 232, 170,
|
619 |
"pale green", 152, 251, 152,
|
620 |
"pale turquoise", 175, 238, 238,
|
621 |
"pale violet red", 219, 112, 147,
|
622 |
"PaleGoldenrod", 238, 232, 170,
|
623 |
"PaleGreen", 152, 251, 152,
|
624 |
"PaleGreen1", 154, 255, 154,
|
625 |
"PaleGreen2", 144, 238, 144,
|
626 |
"PaleGreen3", 124, 205, 124,
|
627 |
"PaleGreen4", 84, 139, 84,
|
628 |
"PaleTurquoise", 175, 238, 238,
|
629 |
"PaleTurquoise1", 187, 255, 255,
|
630 |
"PaleTurquoise2", 174, 238, 238,
|
631 |
"PaleTurquoise3", 150, 205, 205,
|
632 |
"PaleTurquoise4", 102, 139, 139,
|
633 |
"PaleVioletRed", 219, 112, 147,
|
634 |
"PaleVioletRed1", 255, 130, 171,
|
635 |
"PaleVioletRed2", 238, 121, 159,
|
636 |
"PaleVioletRed3", 205, 104, 137,
|
637 |
"PaleVioletRed4", 139, 71, 93,
|
638 |
"papaya whip", 255, 239, 213,
|
639 |
"PapayaWhip", 255, 239, 213,
|
640 |
"peach puff", 255, 218, 185,
|
641 |
"PeachPuff", 255, 218, 185,
|
642 |
"PeachPuff1", 255, 218, 185,
|
643 |
"PeachPuff2", 238, 203, 173,
|
644 |
"PeachPuff3", 205, 175, 149,
|
645 |
"PeachPuff4", 139, 119, 101,
|
646 |
"peru", 205, 133, 63,
|
647 |
"pink", 255, 192, 203,
|
648 |
"pink1", 255, 181, 197,
|
649 |
"pink2", 238, 169, 184,
|
650 |
"pink3", 205, 145, 158,
|
651 |
"pink4", 139, 99, 108,
|
652 |
"plum", 221, 160, 221,
|
653 |
"plum1", 255, 187, 255,
|
654 |
"plum2", 238, 174, 238,
|
655 |
"plum3", 205, 150, 205,
|
656 |
"plum4", 139, 102, 139,
|
657 |
"powder blue", 176, 224, 230,
|
658 |
"PowderBlue", 176, 224, 230,
|
659 |
"purple", 160, 32, 240,
|
660 |
"purple1", 155, 48, 255,
|
661 |
"purple2", 145, 44, 238,
|
662 |
"purple3", 125, 38, 205,
|
663 |
"purple4", 85, 26, 139,
|
664 |
"red", 255, 0, 0,
|
665 |
"red1", 255, 0, 0,
|
666 |
"red2", 238, 0, 0,
|
667 |
"red3", 205, 0, 0,
|
668 |
"red4", 139, 0, 0,
|
669 |
"rosy brown", 188, 143, 143,
|
670 |
"RosyBrown", 188, 143, 143,
|
671 |
"RosyBrown1", 255, 193, 193,
|
672 |
"RosyBrown2", 238, 180, 180,
|
673 |
"RosyBrown3", 205, 155, 155,
|
674 |
"RosyBrown4", 139, 105, 105,
|
675 |
"royal blue", 65, 105, 225,
|
676 |
"RoyalBlue", 65, 105, 225,
|
677 |
"RoyalBlue1", 72, 118, 255,
|
678 |
"RoyalBlue2", 67, 110, 238,
|
679 |
"RoyalBlue3", 58, 95, 205,
|
680 |
"RoyalBlue4", 39, 64, 139,
|
681 |
"saddle brown", 139, 69, 19,
|
682 |
"SaddleBrown", 139, 69, 19,
|
683 |
"salmon", 250, 128, 114,
|
684 |
"salmon1", 255, 140, 105,
|
685 |
"salmon2", 238, 130, 98,
|
686 |
"salmon3", 205, 112, 84,
|
687 |
"salmon4", 139, 76, 57,
|
688 |
"sandy brown", 244, 164, 96,
|
689 |
"SandyBrown", 244, 164, 96,
|
690 |
"sea green", 46, 139, 87,
|
691 |
"SeaGreen", 46, 139, 87,
|
692 |
"SeaGreen1", 84, 255, 159,
|
693 |
"SeaGreen2", 78, 238, 148,
|
694 |
"SeaGreen3", 67, 205, 128,
|
695 |
"SeaGreen4", 46, 139, 87,
|
696 |
"seashell", 255, 245, 238,
|
697 |
"seashell1", 255, 245, 238,
|
698 |
"seashell2", 238, 229, 222,
|
699 |
"seashell3", 205, 197, 191,
|
700 |
"seashell4", 139, 134, 130,
|
701 |
"sienna", 160, 82, 45,
|
702 |
"sienna1", 255, 130, 71,
|
703 |
"sienna2", 238, 121, 66,
|
704 |
"sienna3", 205, 104, 57,
|
705 |
"sienna4", 139, 71, 38,
|
706 |
"sky blue", 135, 206, 235,
|
707 |
"SkyBlue", 135, 206, 235,
|
708 |
"SkyBlue1", 135, 206, 255,
|
709 |
"SkyBlue2", 126, 192, 238,
|
710 |
"SkyBlue3", 108, 166, 205,
|
711 |
"SkyBlue4", 74, 112, 139,
|
712 |
"slate blue", 106, 90, 205,
|
713 |
"slate gray", 112, 128, 144,
|
714 |
"slate grey", 112, 128, 144,
|
715 |
"SlateBlue", 106, 90, 205,
|
716 |
"SlateBlue1", 131, 111, 255,
|
717 |
"SlateBlue2", 122, 103, 238,
|
718 |
"SlateBlue3", 105, 89, 205,
|
719 |
"SlateBlue4", 71, 60, 139,
|
720 |
"SlateGray", 112, 128, 144,
|
721 |
"SlateGray1", 198, 226, 255,
|
722 |
"SlateGray2", 185, 211, 238,
|
723 |
"SlateGray3", 159, 182, 205,
|
724 |
"SlateGray4", 108, 123, 139,
|
725 |
"SlateGrey", 112, 128, 144,
|
726 |
"snow", 255, 250, 250,
|
727 |
"snow1", 255, 250, 250,
|
728 |
"snow2", 238, 233, 233,
|
729 |
"snow3", 205, 201, 201,
|
730 |
"snow4", 139, 137, 137,
|
731 |
"spring green", 0, 255, 127,
|
732 |
"SpringGreen", 0, 255, 127,
|
733 |
"SpringGreen1", 0, 255, 127,
|
734 |
"SpringGreen2", 0, 238, 118,
|
735 |
"SpringGreen3", 0, 205, 102,
|
736 |
"SpringGreen4", 0, 139, 69,
|
737 |
"steel blue", 70, 130, 180,
|
738 |
"SteelBlue", 70, 130, 180,
|
739 |
"SteelBlue1", 99, 184, 255,
|
740 |
"SteelBlue2", 92, 172, 238,
|
741 |
"SteelBlue3", 79, 148, 205,
|
742 |
"SteelBlue4", 54, 100, 139,
|
743 |
"tan", 210, 180, 140,
|
744 |
"tan1", 255, 165, 79,
|
745 |
"tan2", 238, 154, 73,
|
746 |
"tan3", 205, 133, 63,
|
747 |
"tan4", 139, 90, 43,
|
748 |
"thistle", 216, 191, 216,
|
749 |
"thistle1", 255, 225, 255,
|
750 |
"thistle2", 238, 210, 238,
|
751 |
"thistle3", 205, 181, 205,
|
752 |
"thistle4", 139, 123, 139,
|
753 |
"tomato", 255, 99, 71,
|
754 |
"tomato1", 255, 99, 71,
|
755 |
"tomato2", 238, 92, 66,
|
756 |
"tomato3", 205, 79, 57,
|
757 |
"tomato4", 139, 54, 38,
|
758 |
"turquoise", 64, 224, 208,
|
759 |
"turquoise1", 0, 245, 255,
|
760 |
"turquoise2", 0, 229, 238,
|
761 |
"turquoise3", 0, 197, 205,
|
762 |
"turquoise4", 0, 134, 139,
|
763 |
"violet", 238, 130, 238,
|
764 |
"violet red", 208, 32, 144,
|
765 |
"VioletRed", 208, 32, 144,
|
766 |
"VioletRed1", 255, 62, 150,
|
767 |
"VioletRed2", 238, 58, 140,
|
768 |
"VioletRed3", 205, 50, 120,
|
769 |
"VioletRed4", 139, 34, 82,
|
770 |
"wheat", 245, 222, 179,
|
771 |
"wheat1", 255, 231, 186,
|
772 |
"wheat2", 238, 216, 174,
|
773 |
"wheat3", 205, 186, 150,
|
774 |
"wheat4", 139, 126, 102,
|
775 |
"white", 255, 255, 255,
|
776 |
"white smoke", 245, 245, 245,
|
777 |
"WhiteSmoke", 245, 245, 245,
|
778 |
"yellow", 255, 255, 0,
|
779 |
"yellow green", 154, 205, 50,
|
780 |
"yellow1", 255, 255, 0,
|
781 |
"yellow2", 238, 238, 0,
|
782 |
"yellow3", 205, 205, 0,
|
783 |
"yellow4", 139, 139, 0,
|
784 |
"YellowGreen", 154, 205, 50,
|
785 |
NULL, 0, 0, 0
|
786 |
};
|
787 |
|
788 |
|
789 |
/*
|
790 |
* This value will be set to the number of colors in the color table
|
791 |
* the first time it is needed.
|
792 |
*/
|
793 |
|
794 |
static int numXColors = 0;
|
795 |
|
796 |
/*
|
797 |
* Forward declarations for functions used only in this file.
|
798 |
*/
|
799 |
|
800 |
static int FindColor _ANSI_ARGS_((const char *name, XColor *colorPtr));
|
801 |
|
802 |
/*
|
803 |
*----------------------------------------------------------------------
|
804 |
*
|
805 |
* FindColor --
|
806 |
*
|
807 |
* This routine finds the color entry that corresponds to the
|
808 |
* specified color.
|
809 |
*
|
810 |
* Results:
|
811 |
* Returns non-zero on success. The RGB values of the XColor
|
812 |
* will be initialized to the proper values on success.
|
813 |
*
|
814 |
* Side effects:
|
815 |
* None.
|
816 |
*
|
817 |
*----------------------------------------------------------------------
|
818 |
*/
|
819 |
|
820 |
static int
|
821 |
FindColor(name, colorPtr)
|
822 |
const char *name;
|
823 |
XColor *colorPtr;
|
824 |
{
|
825 |
int l, u, r, i;
|
826 |
|
827 |
/*
|
828 |
* Count the number of elements in the color array if we haven't
|
829 |
* done so yet.
|
830 |
*/
|
831 |
|
832 |
if (numXColors == 0) {
|
833 |
XColorEntry *ePtr;
|
834 |
for (ePtr = xColors; ePtr->name != NULL; ePtr++) {
|
835 |
numXColors++;
|
836 |
}
|
837 |
}
|
838 |
|
839 |
/*
|
840 |
* Perform a binary search on the sorted array of colors.
|
841 |
*/
|
842 |
|
843 |
l = 0;
|
844 |
u = numXColors - 1;
|
845 |
while (l <= u) {
|
846 |
i = (l + u) / 2;
|
847 |
r = strcasecmp(name, xColors[i].name);
|
848 |
if (r == 0) {
|
849 |
break;
|
850 |
} else if (r < 0) {
|
851 |
u = i-1;
|
852 |
} else {
|
853 |
l = i+1;
|
854 |
}
|
855 |
}
|
856 |
if (l > u) {
|
857 |
return 0;
|
858 |
}
|
859 |
colorPtr->red = ((xColors[i].red << 8) | xColors[i].red);
|
860 |
colorPtr->green = ((xColors[i].green << 8) | xColors[i].green);
|
861 |
colorPtr->blue = ((xColors[i].blue << 8) | xColors[i].blue);
|
862 |
return 1;
|
863 |
}
|
864 |
|
865 |
/*
|
866 |
*----------------------------------------------------------------------
|
867 |
*
|
868 |
* XParseColor --
|
869 |
*
|
870 |
* Partial implementation of X color name parsing interface.
|
871 |
*
|
872 |
* Results:
|
873 |
* Returns non-zero on success.
|
874 |
*
|
875 |
* Side effects:
|
876 |
* None.
|
877 |
*
|
878 |
*----------------------------------------------------------------------
|
879 |
*/
|
880 |
|
881 |
Status
|
882 |
XParseColor(display, map, spec, colorPtr)
|
883 |
Display *display;
|
884 |
Colormap map;
|
885 |
const char* spec;
|
886 |
XColor *colorPtr;
|
887 |
{
|
888 |
if (spec[0] == '#') {
|
889 |
char fmt[16];
|
890 |
int i, red, green, blue;
|
891 |
|
892 |
if ((i = strlen(spec+1))%3) {
|
893 |
return 0;
|
894 |
}
|
895 |
i /= 3;
|
896 |
|
897 |
sprintf(fmt, "%%%dx%%%dx%%%dx", i, i, i);
|
898 |
if (sscanf(spec+1, fmt, &red, &green, &blue) != 3) {
|
899 |
return 0;
|
900 |
}
|
901 |
colorPtr->red = (((unsigned short) red) << (4 * (4 - i)))
|
902 |
| ((unsigned short) red);
|
903 |
colorPtr->green = (((unsigned short) green) << (4 * (4 - i)))
|
904 |
| ((unsigned short) green);
|
905 |
colorPtr->blue = (((unsigned short) blue) << (4 * (4 - i)))
|
906 |
| ((unsigned short) blue);
|
907 |
} else {
|
908 |
if (!FindColor(spec, colorPtr)) {
|
909 |
return 0;
|
910 |
}
|
911 |
}
|
912 |
colorPtr->pixel = TkpGetPixel(colorPtr);
|
913 |
colorPtr->flags = DoRed|DoGreen|DoBlue;
|
914 |
colorPtr->pad = 0;
|
915 |
return 1;
|
916 |
}
|
917 |
|
918 |
|
919 |
/* $History: xcolors.c $
|
920 |
*
|
921 |
* ***************** Version 1 *****************
|
922 |
* User: Dtashley Date: 1/02/01 Time: 3:22a
|
923 |
* Created in $/IjuScripter, IjuConsole/Source/Tk Base
|
924 |
* Initial check-in.
|
925 |
*/
|
926 |
|
927 |
/* End of XCOLORS.C */ |