pytermgui.color_info

The xterm-spec color table.

  1"""The xterm-spec color table."""
  2
  3# Adapted from https://gist.github.com/MicahElliott/719710
  4# TODO: Maybe this could be generated dynamically?
  5#       See https://superuser.com/a/905280
  6COLOR_TABLE = [
  7    (0, 0, 0),
  8    (170, 0, 0),
  9    (0, 170, 0),
 10    (170, 85, 0),
 11    (0, 0, 170),
 12    (170, 0, 170),
 13    (0, 170, 170),
 14    (170, 170, 170),
 15    (85, 85, 85),
 16    (255, 85, 85),
 17    (85, 255, 85),
 18    (255, 255, 85),
 19    (85, 85, 255),
 20    (255, 85, 255),
 21    (85, 255, 255),
 22    (255, 255, 255),
 23    (0, 0, 0),
 24    (0, 0, 95),
 25    (0, 0, 135),
 26    (0, 0, 175),
 27    (0, 0, 215),
 28    (0, 0, 255),
 29    (0, 95, 0),
 30    (0, 95, 95),
 31    (0, 95, 135),
 32    (0, 95, 175),
 33    (0, 95, 215),
 34    (0, 95, 255),
 35    (0, 135, 0),
 36    (0, 135, 95),
 37    (0, 135, 135),
 38    (0, 135, 175),
 39    (0, 135, 215),
 40    (0, 135, 255),
 41    (0, 175, 0),
 42    (0, 175, 95),
 43    (0, 175, 135),
 44    (0, 175, 175),
 45    (0, 175, 215),
 46    (0, 175, 255),
 47    (0, 215, 0),
 48    (0, 215, 95),
 49    (0, 215, 135),
 50    (0, 215, 175),
 51    (0, 215, 215),
 52    (0, 215, 255),
 53    (0, 255, 0),
 54    (0, 255, 95),
 55    (0, 255, 135),
 56    (0, 255, 175),
 57    (0, 255, 215),
 58    (0, 255, 255),
 59    (95, 0, 0),
 60    (95, 0, 95),
 61    (95, 0, 135),
 62    (95, 0, 175),
 63    (95, 0, 215),
 64    (95, 0, 255),
 65    (95, 95, 0),
 66    (95, 95, 95),
 67    (95, 95, 135),
 68    (95, 95, 175),
 69    (95, 95, 215),
 70    (95, 95, 255),
 71    (95, 135, 0),
 72    (95, 135, 95),
 73    (95, 135, 135),
 74    (95, 135, 175),
 75    (95, 135, 215),
 76    (95, 135, 255),
 77    (95, 175, 0),
 78    (95, 175, 95),
 79    (95, 175, 135),
 80    (95, 175, 175),
 81    (95, 175, 215),
 82    (95, 175, 255),
 83    (95, 215, 0),
 84    (95, 215, 95),
 85    (95, 215, 135),
 86    (95, 215, 175),
 87    (95, 215, 215),
 88    (95, 215, 255),
 89    (95, 255, 0),
 90    (95, 255, 95),
 91    (95, 255, 135),
 92    (95, 255, 175),
 93    (95, 255, 215),
 94    (95, 255, 255),
 95    (135, 0, 0),
 96    (135, 0, 95),
 97    (135, 0, 135),
 98    (135, 0, 175),
 99    (135, 0, 215),
100    (135, 0, 255),
101    (135, 95, 0),
102    (135, 95, 95),
103    (135, 95, 135),
104    (135, 95, 175),
105    (135, 95, 215),
106    (135, 95, 255),
107    (135, 135, 0),
108    (135, 135, 95),
109    (135, 135, 135),
110    (135, 135, 175),
111    (135, 135, 215),
112    (135, 135, 255),
113    (135, 175, 0),
114    (135, 175, 95),
115    (135, 175, 135),
116    (135, 175, 175),
117    (135, 175, 215),
118    (135, 175, 255),
119    (135, 215, 0),
120    (135, 215, 95),
121    (135, 215, 135),
122    (135, 215, 175),
123    (135, 215, 215),
124    (135, 215, 255),
125    (135, 255, 0),
126    (135, 255, 95),
127    (135, 255, 135),
128    (135, 255, 175),
129    (135, 255, 215),
130    (135, 255, 255),
131    (175, 0, 0),
132    (175, 0, 95),
133    (175, 0, 135),
134    (175, 0, 175),
135    (175, 0, 215),
136    (175, 0, 255),
137    (175, 95, 0),
138    (175, 95, 95),
139    (175, 95, 135),
140    (175, 95, 175),
141    (175, 95, 215),
142    (175, 95, 255),
143    (175, 135, 0),
144    (175, 135, 95),
145    (175, 135, 135),
146    (175, 135, 175),
147    (175, 135, 215),
148    (175, 135, 255),
149    (175, 175, 0),
150    (175, 175, 95),
151    (175, 175, 135),
152    (175, 175, 175),
153    (175, 175, 215),
154    (175, 175, 255),
155    (175, 215, 0),
156    (175, 215, 95),
157    (175, 215, 135),
158    (175, 215, 175),
159    (175, 215, 215),
160    (175, 215, 255),
161    (175, 255, 0),
162    (175, 255, 95),
163    (175, 255, 135),
164    (175, 255, 175),
165    (175, 255, 215),
166    (175, 255, 255),
167    (215, 0, 0),
168    (215, 0, 95),
169    (215, 0, 135),
170    (215, 0, 175),
171    (215, 0, 215),
172    (215, 0, 255),
173    (215, 95, 0),
174    (215, 95, 95),
175    (215, 95, 135),
176    (215, 95, 175),
177    (215, 95, 215),
178    (215, 95, 255),
179    (215, 135, 0),
180    (215, 135, 95),
181    (215, 135, 135),
182    (215, 135, 175),
183    (215, 135, 215),
184    (215, 135, 255),
185    (215, 175, 0),
186    (215, 175, 95),
187    (215, 175, 135),
188    (215, 175, 175),
189    (215, 175, 215),
190    (215, 175, 255),
191    (215, 215, 0),
192    (215, 215, 95),
193    (215, 215, 135),
194    (215, 215, 175),
195    (215, 215, 215),
196    (215, 215, 255),
197    (215, 255, 0),
198    (215, 255, 95),
199    (215, 255, 135),
200    (215, 255, 175),
201    (215, 255, 215),
202    (215, 255, 255),
203    (255, 0, 0),
204    (255, 0, 95),
205    (255, 0, 135),
206    (255, 0, 175),
207    (255, 0, 215),
208    (255, 0, 255),
209    (255, 95, 0),
210    (255, 95, 95),
211    (255, 95, 135),
212    (255, 95, 175),
213    (255, 95, 215),
214    (255, 95, 255),
215    (255, 135, 0),
216    (255, 135, 95),
217    (255, 135, 135),
218    (255, 135, 175),
219    (255, 135, 215),
220    (255, 135, 255),
221    (255, 175, 0),
222    (255, 175, 95),
223    (255, 175, 135),
224    (255, 175, 175),
225    (255, 175, 215),
226    (255, 175, 255),
227    (255, 215, 0),
228    (255, 215, 95),
229    (255, 215, 135),
230    (255, 215, 175),
231    (255, 215, 215),
232    (255, 215, 255),
233    (255, 255, 0),
234    (255, 255, 95),
235    (255, 255, 135),
236    (255, 255, 175),
237    (255, 255, 215),
238    (255, 255, 255),
239    (8, 8, 8),
240    (18, 18, 18),
241    (28, 28, 28),
242    (38, 38, 38),
243    (48, 48, 48),
244    (58, 58, 58),
245    (68, 68, 68),
246    (78, 78, 78),
247    (88, 88, 88),
248    (98, 98, 98),
249    (108, 108, 108),
250    (118, 118, 118),
251    (128, 128, 128),
252    (138, 138, 138),
253    (148, 148, 148),
254    (158, 158, 158),
255    (168, 168, 168),
256    (178, 178, 178),
257    (188, 188, 188),
258    (198, 198, 198),
259    (208, 208, 208),
260    (218, 218, 218),
261    (228, 228, 228),
262    (238, 238, 238),
263]
264
265# Taken from the webcolors library
266CSS_COLORS = {
267    "aliceblue": "#f0f8ff",
268    "antiquewhite": "#faebd7",
269    "aqua": "#00ffff",
270    "aquamarine": "#7fffd4",
271    "azure": "#f0ffff",
272    "beige": "#f5f5dc",
273    "bisque": "#ffe4c4",
274    "black": "#000000",
275    "blanchedalmond": "#ffebcd",
276    "blue": "#0000ff",
277    "blueviolet": "#8a2be2",
278    "brown": "#a52a2a",
279    "burlywood": "#deb887",
280    "cadetblue": "#5f9ea0",
281    "chartreuse": "#7fff00",
282    "chocolate": "#d2691e",
283    "coral": "#ff7f50",
284    "cornflowerblue": "#6495ed",
285    "cornsilk": "#fff8dc",
286    "crimson": "#dc143c",
287    "cyan": "#00ffff",
288    "darkblue": "#00008b",
289    "darkcyan": "#008b8b",
290    "darkgoldenrod": "#b8860b",
291    "darkgray": "#a9a9a9",
292    "darkgrey": "#a9a9a9",
293    "darkgreen": "#006400",
294    "darkkhaki": "#bdb76b",
295    "darkmagenta": "#8b008b",
296    "darkolivegreen": "#556b2f",
297    "darkorange": "#ff8c00",
298    "darkorchid": "#9932cc",
299    "darkred": "#8b0000",
300    "darksalmon": "#e9967a",
301    "darkseagreen": "#8fbc8f",
302    "darkslateblue": "#483d8b",
303    "darkslategray": "#2f4f4f",
304    "darkslategrey": "#2f4f4f",
305    "darkturquoise": "#00ced1",
306    "darkviolet": "#9400d3",
307    "deeppink": "#ff1493",
308    "deepskyblue": "#00bfff",
309    "dimgray": "#696969",
310    "dimgrey": "#696969",
311    "dodgerblue": "#1e90ff",
312    "firebrick": "#b22222",
313    "floralwhite": "#fffaf0",
314    "forestgreen": "#228b22",
315    "fuchsia": "#ff00ff",
316    "gainsboro": "#dcdcdc",
317    "ghostwhite": "#f8f8ff",
318    "gold": "#ffd700",
319    "goldenrod": "#daa520",
320    "gray": "#808080",
321    "grey": "#808080",
322    "green": "#008000",
323    "greenyellow": "#adff2f",
324    "honeydew": "#f0fff0",
325    "hotpink": "#ff69b4",
326    "indianred": "#cd5c5c",
327    "indigo": "#4b0082",
328    "ivory": "#fffff0",
329    "khaki": "#f0e68c",
330    "lavender": "#e6e6fa",
331    "lavenderblush": "#fff0f5",
332    "lawngreen": "#7cfc00",
333    "lemonchiffon": "#fffacd",
334    "lightblue": "#add8e6",
335    "lightcoral": "#f08080",
336    "lightcyan": "#e0ffff",
337    "lightgoldenrodyellow": "#fafad2",
338    "lightgray": "#d3d3d3",
339    "lightgrey": "#d3d3d3",
340    "lightgreen": "#90ee90",
341    "lightpink": "#ffb6c1",
342    "lightsalmon": "#ffa07a",
343    "lightseagreen": "#20b2aa",
344    "lightskyblue": "#87cefa",
345    "lightslategray": "#778899",
346    "lightslategrey": "#778899",
347    "lightsteelblue": "#b0c4de",
348    "lightyellow": "#ffffe0",
349    "lime": "#00ff00",
350    "limegreen": "#32cd32",
351    "linen": "#faf0e6",
352    "magenta": "#ff00ff",
353    "maroon": "#800000",
354    "mediumaquamarine": "#66cdaa",
355    "mediumblue": "#0000cd",
356    "mediumorchid": "#ba55d3",
357    "mediumpurple": "#9370db",
358    "mediumseagreen": "#3cb371",
359    "mediumslateblue": "#7b68ee",
360    "mediumspringgreen": "#00fa9a",
361    "mediumturquoise": "#48d1cc",
362    "mediumvioletred": "#c71585",
363    "midnightblue": "#191970",
364    "mintcream": "#f5fffa",
365    "mistyrose": "#ffe4e1",
366    "moccasin": "#ffe4b5",
367    "navajowhite": "#ffdead",
368    "navy": "#000080",
369    "oldlace": "#fdf5e6",
370    "olive": "#808000",
371    "olivedrab": "#6b8e23",
372    "orange": "#ffa500",
373    "orangered": "#ff4500",
374    "orchid": "#da70d6",
375    "palegoldenrod": "#eee8aa",
376    "palegreen": "#98fb98",
377    "paleturquoise": "#afeeee",
378    "palevioletred": "#db7093",
379    "papayawhip": "#ffefd5",
380    "peachpuff": "#ffdab9",
381    "peru": "#cd853f",
382    "pink": "#ffc0cb",
383    "plum": "#dda0dd",
384    "powderblue": "#b0e0e6",
385    "purple": "#800080",
386    "red": "#ff0000",
387    "rosybrown": "#bc8f8f",
388    "royalblue": "#4169e1",
389    "saddlebrown": "#8b4513",
390    "salmon": "#fa8072",
391    "sandybrown": "#f4a460",
392    "seagreen": "#2e8b57",
393    "seashell": "#fff5ee",
394    "sienna": "#a0522d",
395    "silver": "#c0c0c0",
396    "skyblue": "#87ceeb",
397    "slateblue": "#6a5acd",
398    "slategray": "#708090",
399    "slategrey": "#708090",
400    "snow": "#fffafa",
401    "springgreen": "#00ff7f",
402    "steelblue": "#4682b4",
403    "tan": "#d2b48c",
404    "teal": "#008080",
405    "thistle": "#d8bfd8",
406    "tomato": "#ff6347",
407    "turquoise": "#40e0d0",
408    "violet": "#ee82ee",
409    "wheat": "#f5deb3",
410    "white": "#ffffff",
411    "whitesmoke": "#f5f5f5",
412    "yellow": "#ffff00",
413    "yellowgreen": "#9acd32",
414}