OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tk/] [xlib/] [xcolors.c] - Blame information for rev 1780

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.