More work to improve documentation generated by sphinx. Also fixes
[pyutils.git] / src / pyutils / ansi.py
1 #!/usr/bin/env python3
2
3 # © Copyright 2021-2022, Scott Gasch
4
5 """
6 A bunch of color names mapped into RGB tuples and some methods for
7 setting the text color, background color, style, etc... using ANSI escape
8 sequences.  See: https://en.wikipedia.org/wiki/ANSI_escape_code.
9 """
10
11 import contextlib
12 import difflib
13 import io
14 import logging
15 import re
16 import sys
17 from abc import abstractmethod
18 from typing import Callable, Dict, Iterable, Optional, Tuple
19
20 from overrides import overrides
21
22 from pyutils import logging_utils, string_utils
23
24 logger = logging.getLogger(__name__)
25
26
27 COLOR_NAMES_TO_RGB: Dict[str, Tuple[int, int, int]] = {
28     "abbey": (0x4C, 0x4F, 0x56),
29     "acadia": (0x1B, 0x14, 0x04),
30     "acapulco": (0x7C, 0xB0, 0xA1),
31     "aero blue": (0xC9, 0xFF, 0xE5),
32     "affair": (0x71, 0x46, 0x93),
33     "akaroa": (0xD4, 0xC4, 0xA8),
34     "alabaster": (0xFA, 0xFA, 0xFA),
35     "albescent white": (0xF5, 0xE9, 0xD3),
36     "algae green": (0x93, 0xDF, 0xB8),
37     "alice blue": (0xF0, 0xF8, 0xFF),
38     "alizarin crimson": (0xE3, 0x26, 0x36),
39     "allports": (0x00, 0x76, 0xA3),
40     "almond frost": (0x90, 0x7B, 0x71),
41     "almond": (0xEE, 0xD9, 0xC4),
42     "alpine": (0xAF, 0x8F, 0x2C),
43     "alto": (0xDB, 0xDB, 0xDB),
44     "aluminium": (0xA9, 0xAC, 0xB6),
45     "amaranth": (0xE5, 0x2B, 0x50),
46     "amazon": (0x3B, 0x7A, 0x57),
47     "amber": (0xFF, 0xBF, 0x00),
48     "americano": (0x87, 0x75, 0x6E),
49     "amethyst smoke": (0xA3, 0x97, 0xB4),
50     "amethyst": (0x99, 0x66, 0xCC),
51     "amour": (0xF9, 0xEA, 0xF3),
52     "amulet": (0x7B, 0x9F, 0x80),
53     "anakiwa": (0x9D, 0xE5, 0xFF),
54     "antique brass": (0xC8, 0x8A, 0x65),
55     "antique bronze": (0x70, 0x4A, 0x07),
56     "antique white": (0xFA, 0xEB, 0xD7),
57     "anzac": (0xE0, 0xB6, 0x46),
58     "apache": (0xDF, 0xBE, 0x6F),
59     "apple blossom": (0xAF, 0x4D, 0x43),
60     "apple green": (0xE2, 0xF3, 0xEC),
61     "apple": (0x4F, 0xA8, 0x3D),
62     "apricot peach": (0xFB, 0xCE, 0xB1),
63     "apricot white": (0xFF, 0xFE, 0xEC),
64     "apricot": (0xEB, 0x93, 0x73),
65     "aqua deep": (0x01, 0x4B, 0x43),
66     "aqua forest": (0x5F, 0xA7, 0x77),
67     "aqua haze": (0xED, 0xF5, 0xF5),
68     "aqua island": (0xA1, 0xDA, 0xD7),
69     "aqua spring": (0xEA, 0xF9, 0xF5),
70     "aqua squeeze": (0xE8, 0xF5, 0xF2),
71     "aqua": (0x00, 0xFF, 0xFF),
72     "aquamarine blue": (0x71, 0xD9, 0xE2),
73     "aquamarine": (0x7F, 0xFF, 0xD4),
74     "arapawa": (0x11, 0x0C, 0x6C),
75     "armadillo": (0x43, 0x3E, 0x37),
76     "arrowtown": (0x94, 0x87, 0x71),
77     "ash": (0xC6, 0xC3, 0xB5),
78     "asparagus": (0x7B, 0xA0, 0x5B),
79     "asphalt": (0x13, 0x0A, 0x06),
80     "astra": (0xFA, 0xEA, 0xB9),
81     "astral": (0x32, 0x7D, 0xA0),
82     "astronaut blue": (0x01, 0x3E, 0x62),
83     "astronaut": (0x28, 0x3A, 0x77),
84     "athens gray": (0xEE, 0xF0, 0xF3),
85     "aths special": (0xEC, 0xEB, 0xCE),
86     "atlantis": (0x97, 0xCD, 0x2D),
87     "atoll": (0x0A, 0x6F, 0x75),
88     "atomic tangerine": (0xFF, 0x99, 0x66),
89     "au chico": (0x97, 0x60, 0x5D),
90     "aubergine": (0x3B, 0x09, 0x10),
91     "australian mint": (0xF5, 0xFF, 0xBE),
92     "avocado": (0x88, 0x8D, 0x65),
93     "axolotl": (0x4E, 0x66, 0x49),
94     "azalea": (0xF7, 0xC8, 0xDA),
95     "aztec": (0x0D, 0x1C, 0x19),
96     "azure radiance": (0x00, 0x7F, 0xFF),
97     "azure": (0xF0, 0xFF, 0xFF),
98     "baby blue": (0xE0, 0xFF, 0xFF),
99     "backup.house": (175, 95, 0),
100     "bahama blue": (0x02, 0x63, 0x95),
101     "bahia": (0xA5, 0xCB, 0x0C),
102     "baja white": (0xFF, 0xF8, 0xD1),
103     "bali hai": (0x85, 0x9F, 0xAF),
104     "baltic sea": (0x2A, 0x26, 0x30),
105     "bamboo": (0xDA, 0x63, 0x04),
106     "banana mania": (0xFB, 0xE7, 0xB2),
107     "bandicoot": (0x85, 0x84, 0x70),
108     "barberry": (0xDE, 0xD7, 0x17),
109     "barley corn": (0xA6, 0x8B, 0x5B),
110     "barley white": (0xFF, 0xF4, 0xCE),
111     "barossa": (0x44, 0x01, 0x2D),
112     "bastille": (0x29, 0x21, 0x30),
113     "battleship gray": (0x82, 0x8F, 0x72),
114     "bay leaf": (0x7D, 0xA9, 0x8D),
115     "bay of many": (0x27, 0x3A, 0x81),
116     "bazaar": (0x98, 0x77, 0x7B),
117     "bean  ": (0x3D, 0x0C, 0x02),
118     "beauty bush": (0xEE, 0xC1, 0xBE),
119     "beaver": (0x92, 0x6F, 0x5B),
120     "beeswax": (0xFE, 0xF2, 0xC7),
121     "beige": (0xF5, 0xF5, 0xDC),
122     "bermuda gray": (0x6B, 0x8B, 0xA2),
123     "bermuda": (0x7D, 0xD8, 0xC6),
124     "beryl green": (0xDE, 0xE5, 0xC0),
125     "bianca": (0xFC, 0xFB, 0xF3),
126     "big stone": (0x16, 0x2A, 0x40),
127     "bilbao": (0x32, 0x7C, 0x14),
128     "biloba flower": (0xB2, 0xA1, 0xEA),
129     "birch": (0x37, 0x30, 0x21),
130     "bird flower": (0xD4, 0xCD, 0x16),
131     "biscay": (0x1B, 0x31, 0x62),
132     "bismark": (0x49, 0x71, 0x83),
133     "bison hide": (0xC1, 0xB7, 0xA4),
134     "bisque": (0xFF, 0xE4, 0xC4),
135     "bistre": (0x3D, 0x2B, 0x1F),
136     "bitter lemon": (0xCA, 0xE0, 0x0D),
137     "bitter": (0x86, 0x89, 0x74),
138     "bittersweet": (0xFE, 0x6F, 0x5E),
139     "bizarre": (0xEE, 0xDE, 0xDA),
140     "black bean": (0x08, 0x19, 0x10),
141     "black forest": (0x0B, 0x13, 0x04),
142     "black haze": (0xF6, 0xF7, 0xF7),
143     "black marlin": (0x3E, 0x2C, 0x1C),
144     "black olive": (0x24, 0x2E, 0x16),
145     "black pearl": (0x04, 0x13, 0x22),
146     "black rock": (0x0D, 0x03, 0x32),
147     "black rose": (0x67, 0x03, 0x2D),
148     "black russian": (0x0A, 0x00, 0x1C),
149     "black squeeze": (0xF2, 0xFA, 0xFA),
150     "black white": (0xFF, 0xFE, 0xF6),
151     "black": (0x00, 0x00, 0x00),
152     "blackberry": (0x4D, 0x01, 0x35),
153     "blackcurrant": (0x32, 0x29, 0x3A),
154     "blanched almond": (0xFF, 0xEB, 0xCD),
155     "blaze orange": (0xFF, 0x66, 0x00),
156     "bleach white": (0xFE, 0xF3, 0xD8),
157     "bleached cedar": (0x2C, 0x21, 0x33),
158     "blizzard blue": (0xA3, 0xE3, 0xED),
159     "blossom": (0xDC, 0xB4, 0xBC),
160     "blue bayoux": (0x49, 0x66, 0x79),
161     "blue bell": (0x99, 0x99, 0xCC),
162     "blue chalk": (0xF1, 0xE9, 0xFF),
163     "blue charcoal": (0x01, 0x0D, 0x1A),
164     "blue chill": (0x0C, 0x89, 0x90),
165     "blue diamond": (0x38, 0x04, 0x74),
166     "blue dianne": (0x20, 0x48, 0x52),
167     "blue gem": (0x2C, 0x0E, 0x8C),
168     "blue haze": (0xBF, 0xBE, 0xD8),
169     "blue lagoon": (0x01, 0x79, 0x87),
170     "blue marguerite": (0x76, 0x66, 0xC6),
171     "blue ribbon": (0x00, 0x66, 0xFF),
172     "blue romance": (0xD2, 0xF6, 0xDE),
173     "blue smoke": (0x74, 0x88, 0x81),
174     "blue stone": (0x01, 0x61, 0x62),
175     "blue violet": (0x8A, 0x2B, 0xE2),
176     "blue whale": (0x04, 0x2E, 0x4C),
177     "blue zodiac": (0x13, 0x26, 0x4D),
178     "blue": (0x00, 0x00, 0xFF),
179     "blumine": (0x18, 0x58, 0x7A),
180     "blush pink": (0xFF, 0x6F, 0xFF),
181     "blush": (0xB4, 0x46, 0x68),
182     "bombay": (0xAF, 0xB1, 0xB8),
183     "bon jour": (0xE5, 0xE0, 0xE1),
184     "bondi blue": (0x00, 0x95, 0xB6),
185     "bone": (0xE4, 0xD1, 0xC0),
186     "bordeaux": (0x5C, 0x01, 0x20),
187     "bossanova": (0x4E, 0x2A, 0x5A),
188     "boston blue": (0x3B, 0x91, 0xB4),
189     "botticelli": (0xC7, 0xDD, 0xE5),
190     "bottle green": (0x09, 0x36, 0x24),
191     "boulder": (0x7A, 0x7A, 0x7A),
192     "bouquet": (0xAE, 0x80, 0x9E),
193     "bourbon": (0xBA, 0x6F, 0x1E),
194     "bracken": (0x4A, 0x2A, 0x04),
195     "brandy punch": (0xCD, 0x84, 0x29),
196     "brandy rose": (0xBB, 0x89, 0x83),
197     "brandy": (0xDE, 0xC1, 0x96),
198     "breaker bay": (0x5D, 0xA1, 0x9F),
199     "brick red": (0xC6, 0x2D, 0x42),
200     "bridal heath": (0xFF, 0xFA, 0xF4),
201     "bridesmaid": (0xFE, 0xF0, 0xEC),
202     "bright gray": (0x3C, 0x41, 0x51),
203     "bright green": (0x66, 0xFF, 0x00),
204     "bright red": (0xB1, 0x00, 0x00),
205     "bright sun": (0xFE, 0xD3, 0x3C),
206     "bright turquoise": (0x08, 0xE8, 0xDE),
207     "brilliant rose": (0xF6, 0x53, 0xA6),
208     "brink pink": (0xFB, 0x60, 0x7F),
209     "bronco": (0xAB, 0xA1, 0x96),
210     "bronze olive": (0x4E, 0x42, 0x0C),
211     "bronze": (0x3F, 0x21, 0x09),
212     "bronzetone": (0x4D, 0x40, 0x0F),
213     "broom": (0xFF, 0xEC, 0x13),
214     "brown bramble": (0x59, 0x28, 0x04),
215     "brown derby": (0x49, 0x26, 0x15),
216     "brown pod": (0x40, 0x18, 0x01),
217     "brown rust": (0xAF, 0x59, 0x3E),
218     "brown tumbleweed": (0x37, 0x29, 0x0E),
219     "brown": (0x96, 0x4B, 0x00),
220     "bubbles": (0xE7, 0xFE, 0xFF),
221     "buccaneer": (0x62, 0x2F, 0x30),
222     "bud": (0xA8, 0xAE, 0x9C),
223     "buddha gold": (0xC1, 0xA0, 0x04),
224     "buff": (0xF0, 0xDC, 0x82),
225     "bulgarian rose": (0x48, 0x06, 0x07),
226     "bull shot": (0x86, 0x4D, 0x1E),
227     "bunker": (0x0D, 0x11, 0x17),
228     "bunting": (0x15, 0x1F, 0x4C),
229     "burgundy": (0x90, 0x00, 0x20),
230     "burlywood": (0xDE, 0xB8, 0x87),
231     "burnham": (0x00, 0x2E, 0x20),
232     "burning orange": (0xFF, 0x70, 0x34),
233     "burning sand": (0xD9, 0x93, 0x76),
234     "burnt maroon": (0x42, 0x03, 0x03),
235     "burnt orange": (0xCC, 0x55, 0x00),
236     "burnt sienna": (0xE9, 0x74, 0x51),
237     "burnt umber": (0x8A, 0x33, 0x24),
238     "bush": (0x0D, 0x2E, 0x1C),
239     "buttercup": (0xF3, 0xAD, 0x16),
240     "buttered rum": (0xA1, 0x75, 0x0D),
241     "butterfly bush": (0x62, 0x4E, 0x9A),
242     "buttermilk": (0xFF, 0xF1, 0xB5),
243     "buttery white": (0xFF, 0xFC, 0xEA),
244     "cab sav": (0x4D, 0x0A, 0x18),
245     "cabaret": (0xD9, 0x49, 0x72),
246     "cabbage pont": (0x3F, 0x4C, 0x3A),
247     "cactus": (0x58, 0x71, 0x56),
248     "cadet blue": (0x5F, 0x9E, 0xA0),
249     "cadillac": (0xB0, 0x4C, 0x6A),
250     "cafe royale": (0x6F, 0x44, 0x0C),
251     "calico": (0xE0, 0xC0, 0x95),
252     "california": (0xFE, 0x9D, 0x04),
253     "calypso": (0x31, 0x72, 0x8D),
254     "camarone": (0x00, 0x58, 0x1A),
255     "camelot": (0x89, 0x34, 0x56),
256     "cameo": (0xD9, 0xB9, 0x9B),
257     "camouflage green": (0x78, 0x86, 0x6B),
258     "camouflage": (0x3C, 0x39, 0x10),
259     "can can": (0xD5, 0x91, 0xA4),
260     "canary": (0xF3, 0xFB, 0x62),
261     "candlelight": (0xFC, 0xD9, 0x17),
262     "candy corn": (0xFB, 0xEC, 0x5D),
263     "cannon black": (0x25, 0x17, 0x06),
264     "cannon pink": (0x89, 0x43, 0x67),
265     "cape cod": (0x3C, 0x44, 0x43),
266     "cape honey": (0xFE, 0xE5, 0xAC),
267     "cape palliser": (0xA2, 0x66, 0x45),
268     "caper": (0xDC, 0xED, 0xB4),
269     "caramel": (0xFF, 0xDD, 0xAF),
270     "cararra": (0xEE, 0xEE, 0xE8),
271     "cardin green": (0x01, 0x36, 0x1C),
272     "cardinal pink": (0x8C, 0x05, 0x5E),
273     "cardinal": (0xC4, 0x1E, 0x3A),
274     "careys pink": (0xD2, 0x9E, 0xAA),
275     "caribbean green": (0x00, 0xCC, 0x99),
276     "carissma": (0xEA, 0x88, 0xA8),
277     "carla": (0xF3, 0xFF, 0xD8),
278     "carmine": (0x96, 0x00, 0x18),
279     "carnaby tan": (0x5C, 0x2E, 0x01),
280     "carnation pink": (0xFF, 0xA6, 0xC9),
281     "carnation": (0xF9, 0x5A, 0x61),
282     "carousel pink": (0xF9, 0xE0, 0xED),
283     "carrot orange": (0xED, 0x91, 0x21),
284     "casablanca": (0xF8, 0xB8, 0x53),
285     "casal": (0x2F, 0x61, 0x68),
286     "cascade": (0x8B, 0xA9, 0xA5),
287     "cashmere": (0xE6, 0xBE, 0xA5),
288     "casper": (0xAD, 0xBE, 0xD1),
289     "castro": (0x52, 0x00, 0x1F),
290     "catalina blue": (0x06, 0x2A, 0x78),
291     "catskill white": (0xEE, 0xF6, 0xF7),
292     "cavern pink": (0xE3, 0xBE, 0xBE),
293     "cedar wood finish": (0x71, 0x1A, 0x00),
294     "cedar": (0x3E, 0x1C, 0x14),
295     "celadon": (0xAC, 0xE1, 0xAF),
296     "celery": (0xB8, 0xC2, 0x5D),
297     "celeste": (0xD1, 0xD2, 0xCA),
298     "cello": (0x1E, 0x38, 0x5B),
299     "celtic": (0x16, 0x32, 0x22),
300     "cement": (0x8D, 0x76, 0x62),
301     "ceramic": (0xFC, 0xFF, 0xF9),
302     "cerise red": (0xDE, 0x31, 0x63),
303     "cerise": (0xDA, 0x32, 0x87),
304     "cerulean blue": (0x2A, 0x52, 0xBE),
305     "cerulean": (0x02, 0xA4, 0xD3),
306     "chablis": (0xFF, 0xF4, 0xF3),
307     "chalet green": (0x51, 0x6E, 0x3D),
308     "chalky": (0xEE, 0xD7, 0x94),
309     "chambray": (0x35, 0x4E, 0x8C),
310     "chamois": (0xED, 0xDC, 0xB1),
311     "champagne": (0xFA, 0xEC, 0xCC),
312     "chantilly": (0xF8, 0xC3, 0xDF),
313     "charade": (0x29, 0x29, 0x37),
314     "chardon": (0xFF, 0xF3, 0xF1),
315     "chardonnay": (0xFF, 0xCD, 0x8C),
316     "charlotte": (0xBA, 0xEE, 0xF9),
317     "charm": (0xD4, 0x74, 0x94),
318     "chartreuse yellow": (0xDF, 0xFF, 0x00),
319     "chartreuse": (0x7F, 0xFF, 0x00),
320     "chateau green": (0x40, 0xA8, 0x60),
321     "chatelle": (0xBD, 0xB3, 0xC7),
322     "chathams blue": (0x17, 0x55, 0x79),
323     "cheetah.house": (95, 0x00, 0x00),
324     "chelsea cucumber": (0x83, 0xAA, 0x5D),
325     "chelsea gem": (0x9E, 0x53, 0x02),
326     "chenin": (0xDF, 0xCD, 0x6F),
327     "cherokee": (0xFC, 0xDA, 0x98),
328     "cherry pie": (0x2A, 0x03, 0x59),
329     "cherrywood": (0x65, 0x1A, 0x14),
330     "cherub": (0xF8, 0xD9, 0xE9),
331     "chestnut rose": (0xCD, 0x5C, 0x5C),
332     "chestnut": (0xB9, 0x4E, 0x48),
333     "chetwode blue": (0x85, 0x81, 0xD9),
334     "chicago": (0x5D, 0x5C, 0x58),
335     "chiffon": (0xF1, 0xFF, 0xC8),
336     "chilean fire": (0xF7, 0x77, 0x03),
337     "chilean heath": (0xFF, 0xFD, 0xE6),
338     "china ivory": (0xFC, 0xFF, 0xE7),
339     "chino": (0xCE, 0xC7, 0xA7),
340     "chinook": (0xA8, 0xE3, 0xBD),
341     "chocolate": (0x37, 0x02, 0x02),
342     "christalle": (0x33, 0x03, 0x6B),
343     "christi": (0x67, 0xA7, 0x12),
344     "christine": (0xE7, 0x73, 0x0A),
345     "chrome white": (0xE8, 0xF1, 0xD4),
346     "cinder": (0x0E, 0x0E, 0x18),
347     "cinderella": (0xFD, 0xE1, 0xDC),
348     "cinnabar": (0xE3, 0x42, 0x34),
349     "cinnamon": (0x7B, 0x3F, 0x00),
350     "cioccolato": (0x55, 0x28, 0x0C),
351     "citrine white": (0xFA, 0xF7, 0xD6),
352     "citron": (0x9E, 0xA9, 0x1F),
353     "citrus": (0xA1, 0xC5, 0x0A),
354     "clairvoyant": (0x48, 0x06, 0x56),
355     "clam shell": (0xD4, 0xB6, 0xAF),
356     "claret": (0x7F, 0x17, 0x34),
357     "classic rose": (0xFB, 0xCC, 0xE7),
358     "clay ash": (0xBD, 0xC8, 0xB3),
359     "clay creek": (0x8A, 0x83, 0x60),
360     "clear day": (0xE9, 0xFF, 0xFD),
361     "clementine": (0xE9, 0x6E, 0x00),
362     "clinker": (0x37, 0x1D, 0x09),
363     "cloud burst": (0x20, 0x2E, 0x54),
364     "cloud": (0xC7, 0xC4, 0xBF),
365     "cloudy": (0xAC, 0xA5, 0x9F),
366     "clover": (0x38, 0x49, 0x10),
367     "cobalt": (0x00, 0x47, 0xAB),
368     "cocoa bean": (0x48, 0x1C, 0x1C),
369     "cocoa brown": (0x30, 0x1F, 0x1E),
370     "coconut cream": (0xF8, 0xF7, 0xDC),
371     "cod gray": (0x0B, 0x0B, 0x0B),
372     "coffee bean": (0x2A, 0x14, 0x0E),
373     "coffee": (0x70, 0x65, 0x55),
374     "cognac": (0x9F, 0x38, 0x1D),
375     "cola": (0x3F, 0x25, 0x00),
376     "cold purple": (0xAB, 0xA0, 0xD9),
377     "cold turkey": (0xCE, 0xBA, 0xBA),
378     "colonial white": (0xFF, 0xED, 0xBC),
379     "comet": (0x5C, 0x5D, 0x75),
380     "como": (0x51, 0x7C, 0x66),
381     "conch": (0xC9, 0xD9, 0xD2),
382     "concord": (0x7C, 0x7B, 0x7A),
383     "concrete": (0xF2, 0xF2, 0xF2),
384     "confetti": (0xE9, 0xD7, 0x5A),
385     "congo brown": (0x59, 0x37, 0x37),
386     "congress blue": (0x02, 0x47, 0x8E),
387     "conifer": (0xAC, 0xDD, 0x4D),
388     "contessa": (0xC6, 0x72, 0x6B),
389     "copper canyon": (0x7E, 0x3A, 0x15),
390     "copper rose": (0x99, 0x66, 0x66),
391     "copper rust": (0x94, 0x47, 0x47),
392     "copper": (0xB8, 0x73, 0x33),
393     "copperfield": (0xDA, 0x8A, 0x67),
394     "coral red": (0xFF, 0x40, 0x40),
395     "coral reef": (0xC7, 0xBC, 0xA2),
396     "coral tree": (0xA8, 0x6B, 0x6B),
397     "coral": (0xFF, 0x7F, 0x50),
398     "corduroy": (0x60, 0x6E, 0x68),
399     "coriander": (0xC4, 0xD0, 0xB0),
400     "cork": (0x40, 0x29, 0x1D),
401     "corn field": (0xF8, 0xFA, 0xCD),
402     "corn harvest": (0x8B, 0x6B, 0x0B),
403     "corn silk": (0xFF, 0xF8, 0xDC),
404     "corn": (0xE7, 0xBF, 0x05),
405     "cornflower blue": (0x64, 0x95, 0xED),
406     "cornflower lilac": (0xFF, 0xB0, 0xAC),
407     "cornflower": (0x93, 0xCC, 0xEA),
408     "corvette": (0xFA, 0xD3, 0xA2),
409     "cosmic": (0x76, 0x39, 0x5D),
410     "cosmos": (0xFF, 0xD8, 0xD9),
411     "costa del sol": (0x61, 0x5D, 0x30),
412     "cotton candy": (0xFF, 0xB7, 0xD5),
413     "cotton seed": (0xC2, 0xBD, 0xB6),
414     "county green": (0x01, 0x37, 0x1A),
415     "cowboy": (0x4D, 0x28, 0x2D),
416     "crail": (0xB9, 0x51, 0x40),
417     "cranberry": (0xDB, 0x50, 0x79),
418     "crater brown": (0x46, 0x24, 0x25),
419     "cream brulee": (0xFF, 0xE5, 0xA0),
420     "cream can": (0xF5, 0xC8, 0x5C),
421     "cream": (0xFF, 0xFD, 0xD0),
422     "creole": (0x1E, 0x0F, 0x04),
423     "crete": (0x73, 0x78, 0x29),
424     "crimson": (0xDC, 0x14, 0x3C),
425     "crocodile": (0x73, 0x6D, 0x58),
426     "crown of thorns": (0x77, 0x1F, 0x1F),
427     "crowshead": (0x1C, 0x12, 0x08),
428     "cruise": (0xB5, 0xEC, 0xDF),
429     "crusoe": (0x00, 0x48, 0x16),
430     "crusta": (0xFD, 0x7B, 0x33),
431     "cumin": (0x92, 0x43, 0x21),
432     "cumulus": (0xFD, 0xFF, 0xD5),
433     "cupid": (0xFB, 0xBE, 0xDA),
434     "curious blue": (0x25, 0x96, 0xD1),
435     "cutty sark": (0x50, 0x76, 0x72),
436     "cyan": (0x00, 0xFF, 0xFF),
437     "cyprus": (0x00, 0x3E, 0x40),
438     "daintree": (0x01, 0x27, 0x31),
439     "dairy cream": (0xF9, 0xE4, 0xBC),
440     "daisy bush": (0x4F, 0x23, 0x98),
441     "dallas": (0x6E, 0x4B, 0x26),
442     "dandelion": (0xFE, 0xD8, 0x5D),
443     "danube": (0x60, 0x93, 0xD1),
444     "dark blue": (0x00, 0x00, 0x8B),
445     "dark burgundy": (0x77, 0x0F, 0x05),
446     "dark cyan": (0x00, 0x8B, 0x8B),
447     "dark ebony": (0x3C, 0x20, 0x05),
448     "dark fern": (0x0A, 0x48, 0x0D),
449     "dark goldenrod": (0xB8, 0x86, 0x0B),
450     "dark gray": (0xA9, 0xA9, 0xA9),
451     "dark green": (0x18, 0x2D, 0x09),
452     "dark magenta": (0xAF, 0x00, 0xAF),
453     "dark olive green": (0x55, 0x6B, 0x2F),
454     "dark orange": (0xFF, 0x8C, 0x00),
455     "dark orchid": (0x99, 0x32, 0xCC),
456     "dark purple": (0x36, 0x00, 0x79),
457     "dark red": (0x64, 0x00, 0x00),
458     "dark salmon": (0xE9, 0x96, 0x7A),
459     "dark sea green": (0x8F, 0xBC, 0x8F),
460     "dark slate gray": (0x2F, 0x4F, 0x4F),
461     "dark tan": (0x66, 0x10, 0x10),
462     "dark turquoise": (0x00, 0xCE, 0xD1),
463     "dark violet": (0x94, 0x00, 0xD3),
464     "dawn pink": (0xF3, 0xE9, 0xE5),
465     "dawn": (0xA6, 0xA2, 0x9A),
466     "de york": (0x7A, 0xC4, 0x88),
467     "deco": (0xD2, 0xDA, 0x97),
468     "deep blue": (0x22, 0x08, 0x78),
469     "deep blush": (0xE4, 0x76, 0x98),
470     "deep bronze": (0x4A, 0x30, 0x04),
471     "deep cerulean": (0x00, 0x7B, 0xA7),
472     "deep cove": (0x05, 0x10, 0x40),
473     "deep fir": (0x00, 0x29, 0x00),
474     "deep forest green": (0x18, 0x2D, 0x09),
475     "deep koamaru": (0x1B, 0x12, 0x7B),
476     "deep oak": (0x41, 0x20, 0x10),
477     "deep pink": (0xFF, 0x14, 0x93),
478     "deep sapphire": (0x08, 0x25, 0x67),
479     "deep sea green": (0x09, 0x58, 0x59),
480     "deep sea": (0x01, 0x82, 0x6B),
481     "deep sky blue": (0x00, 0xBF, 0xFF),
482     "deep teal": (0x00, 0x35, 0x32),
483     "del rio": (0xB0, 0x9A, 0x95),
484     "dell": (0x39, 0x64, 0x13),
485     "delta": (0xA4, 0xA4, 0x9D),
486     "deluge": (0x75, 0x63, 0xA8),
487     "denim": (0x15, 0x60, 0xBD),
488     "derby": (0xFF, 0xEE, 0xD8),
489     "desert sand": (0xED, 0xC9, 0xAF),
490     "desert storm": (0xF8, 0xF8, 0xF7),
491     "desert": (0xAE, 0x60, 0x20),
492     "dew": (0xEA, 0xFF, 0xFE),
493     "di serria": (0xDB, 0x99, 0x5E),
494     "diesel": (0x13, 0x00, 0x00),
495     "dim gray": (0x69, 0x69, 0x69),
496     "dingley": (0x5D, 0x77, 0x47),
497     "disco": (0x87, 0x15, 0x50),
498     "dixie": (0xE2, 0x94, 0x18),
499     "dodger blue": (0x1E, 0x90, 0xFF),
500     "dolly": (0xF9, 0xFF, 0x8B),
501     "dolphin": (0x64, 0x60, 0x77),
502     "domino": (0x8E, 0x77, 0x5E),
503     "don juan": (0x5D, 0x4C, 0x51),
504     "donkey brown": (0xA6, 0x92, 0x79),
505     "dorado": (0x6B, 0x57, 0x55),
506     "double colonial white": (0xEE, 0xE3, 0xAD),
507     "double pearl lusta": (0xFC, 0xF4, 0xD0),
508     "double spanish white": (0xE6, 0xD7, 0xB9),
509     "dove gray": (0x6D, 0x6C, 0x6C),
510     "downriver": (0x09, 0x22, 0x56),
511     "downy": (0x6F, 0xD0, 0xC5),
512     "driftwood": (0xAF, 0x87, 0x51),
513     "drover": (0xFD, 0xF7, 0xAD),
514     "dull lavender": (0xA8, 0x99, 0xE6),
515     "dune": (0x38, 0x35, 0x33),
516     "dust storm": (0xE5, 0xCC, 0xC9),
517     "dusty gray": (0xA8, 0x98, 0x9B),
518     "eagle": (0xB6, 0xBA, 0xA4),
519     "earls green": (0xC9, 0xB9, 0x3B),
520     "early dawn": (0xFF, 0xF9, 0xE6),
521     "east bay": (0x41, 0x4C, 0x7D),
522     "east side": (0xAC, 0x91, 0xCE),
523     "eastern blue": (0x1E, 0x9A, 0xB0),
524     "ebb": (0xE9, 0xE3, 0xE3),
525     "ebony clay": (0x26, 0x28, 0x3B),
526     "ebony": (0x0C, 0x0B, 0x1D),
527     "eclipse": (0x31, 0x1C, 0x17),
528     "ecru white": (0xF5, 0xF3, 0xE5),
529     "ecstasy": (0xFA, 0x78, 0x14),
530     "eden": (0x10, 0x58, 0x52),
531     "edgewater": (0xC8, 0xE3, 0xD7),
532     "edward": (0xA2, 0xAE, 0xAB),
533     "egg sour": (0xFF, 0xF4, 0xDD),
534     "egg white": (0xFF, 0xEF, 0xC1),
535     "eggplant": (0x61, 0x40, 0x51),
536     "el paso": (0x1E, 0x17, 0x08),
537     "el salva": (0x8F, 0x3E, 0x33),
538     "electric lime": (0xCC, 0xFF, 0x00),
539     "electric violet": (0x8B, 0x00, 0xFF),
540     "elephant": (0x12, 0x34, 0x47),
541     "elf green": (0x1B, 0x8A, 0x6B),
542     "elm": (0x1C, 0x7C, 0x7D),
543     "emerald": (0x50, 0xC8, 0x78),
544     "eminence": (0x6C, 0x30, 0x82),
545     "emperor": (0x51, 0x46, 0x49),
546     "empress": (0x81, 0x73, 0x77),
547     "endeavour": (0x00, 0x56, 0xA7),
548     "energy yellow": (0xF8, 0xDD, 0x5C),
549     "english holly": (0x02, 0x2D, 0x15),
550     "english walnut": (0x3E, 0x2B, 0x23),
551     "envy": (0x8B, 0xA6, 0x90),
552     "equator": (0xE1, 0xBC, 0x64),
553     "espresso": (0x61, 0x27, 0x18),
554     "eternity": (0x21, 0x1A, 0x0E),
555     "eucalyptus": (0x27, 0x8A, 0x5B),
556     "eunry": (0xCF, 0xA3, 0x9D),
557     "evening sea": (0x02, 0x4E, 0x46),
558     "everglade": (0x1C, 0x40, 0x2E),
559     "faded jade": (0x42, 0x79, 0x77),
560     "fair pink": (0xFF, 0xEF, 0xEC),
561     "falcon": (0x7F, 0x62, 0x6D),
562     "fall green": (0xEC, 0xEB, 0xBD),
563     "falu red": (0x80, 0x18, 0x18),
564     "fantasy": (0xFA, 0xF3, 0xF0),
565     "fedora": (0x79, 0x6A, 0x78),
566     "feijoa": (0x9F, 0xDD, 0x8C),
567     "fern frond": (0x65, 0x72, 0x20),
568     "fern green": (0x4F, 0x79, 0x42),
569     "fern": (0x63, 0xB7, 0x6C),
570     "ferra": (0x70, 0x4F, 0x50),
571     "festival": (0xFB, 0xE9, 0x6C),
572     "feta": (0xF0, 0xFC, 0xEA),
573     "fiery orange": (0xB3, 0x52, 0x13),
574     "finch": (0x62, 0x66, 0x49),
575     "finlandia": (0x55, 0x6D, 0x56),
576     "finn": (0x69, 0x2D, 0x54),
577     "fiord": (0x40, 0x51, 0x69),
578     "fire brick": (0xB2, 0x22, 0x22),
579     "fire bush": (0xE8, 0x99, 0x28),
580     "fire": (0xAA, 0x42, 0x03),
581     "firefly": (0x0E, 0x2A, 0x30),
582     "flame pea": (0xDA, 0x5B, 0x38),
583     "flamenco": (0xFF, 0x7D, 0x07),
584     "flamingo": (0xF2, 0x55, 0x2A),
585     "flax smoke": (0x7B, 0x82, 0x65),
586     "flax": (0xEE, 0xDC, 0x82),
587     "flesh": (0xFF, 0xCB, 0xA4),
588     "flint": (0x6F, 0x6A, 0x61),
589     "flirt": (0xA2, 0x00, 0x6D),
590     "floral white": (0xFF, 0xFA, 0xF0),
591     "flush mahogany": (0xCA, 0x34, 0x35),
592     "flush orange": (0xFF, 0x7F, 0x00),
593     "foam": (0xD8, 0xFC, 0xFA),
594     "fog": (0xD7, 0xD0, 0xFF),
595     "foggy gray": (0xCB, 0xCA, 0xB6),
596     "forest green": (0x22, 0x8B, 0x22),
597     "forget me not": (0xFF, 0xF1, 0xEE),
598     "fountain blue": (0x56, 0xB4, 0xBE),
599     "frangipani": (0xFF, 0xDE, 0xB3),
600     "french gray": (0xBD, 0xBD, 0xC6),
601     "french lilac": (0xEC, 0xC7, 0xEE),
602     "french pass": (0xBD, 0xED, 0xFD),
603     "french rose": (0xF6, 0x4A, 0x8A),
604     "fresh eggplant": (0x99, 0x00, 0x66),
605     "friar gray": (0x80, 0x7E, 0x79),
606     "fringy flower": (0xB1, 0xE2, 0xC1),
607     "froly": (0xF5, 0x75, 0x84),
608     "frost": (0xED, 0xF5, 0xDD),
609     "frosted mint": (0xDB, 0xFF, 0xF8),
610     "frostee": (0xE4, 0xF6, 0xE7),
611     "fruit salad": (0x4F, 0x9D, 0x5D),
612     "fuchsia blue": (0x7A, 0x58, 0xC1),
613     "fuchsia pink": (0xC1, 0x54, 0xC1),
614     "fuchsia": (0xFF, 0x00, 0xFF),
615     "fuego": (0xBE, 0xDE, 0x0D),
616     "fuel yellow": (0xEC, 0xA9, 0x27),
617     "fun blue": (0x19, 0x59, 0xA8),
618     "fun green": (0x01, 0x6D, 0x39),
619     "fuscous gray": (0x54, 0x53, 0x4D),
620     "fuzzy wuzzy brown": (0xC4, 0x56, 0x55),
621     "gable green": (0x16, 0x35, 0x31),
622     "gainsboro": (0xDC, 0xDC, 0xDC),
623     "gallery": (0xEF, 0xEF, 0xEF),
624     "galliano": (0xDC, 0xB2, 0x0C),
625     "gamboge": (0xE4, 0x9B, 0x0F),
626     "geebung": (0xD1, 0x8F, 0x1B),
627     "genoa": (0x15, 0x73, 0x6B),
628     "geraldine": (0xFB, 0x89, 0x89),
629     "geyser": (0xD4, 0xDF, 0xE2),
630     "ghost white": (0xF8, 0xF8, 0xFF),
631     "ghost": (0xC7, 0xC9, 0xD5),
632     "gigas": (0x52, 0x3C, 0x94),
633     "gimblet": (0xB8, 0xB5, 0x6A),
634     "gin fizz": (0xFF, 0xF9, 0xE2),
635     "gin": (0xE8, 0xF2, 0xEB),
636     "givry": (0xF8, 0xE4, 0xBF),
637     "glacier": (0x80, 0xB3, 0xC4),
638     "glade green": (0x61, 0x84, 0x5F),
639     "go ben": (0x72, 0x6D, 0x4E),
640     "goblin": (0x3D, 0x7D, 0x52),
641     "gold drop": (0xF1, 0x82, 0x00),
642     "gold sand": (0xE6, 0xBE, 0x8A),
643     "gold tips": (0xDE, 0xBA, 0x13),
644     "gold": (0xFF, 0xD7, 0x00),
645     "golden bell": (0xE2, 0x89, 0x13),
646     "golden dream": (0xF0, 0xD5, 0x2D),
647     "golden fizz": (0xF5, 0xFB, 0x3D),
648     "golden glow": (0xFD, 0xE2, 0x95),
649     "golden grass": (0xDA, 0xA5, 0x20),
650     "golden sand": (0xF0, 0xDB, 0x7D),
651     "golden tainoi": (0xFF, 0xCC, 0x5C),
652     "goldenrod": (0xFC, 0xD6, 0x67),
653     "gondola": (0x26, 0x14, 0x14),
654     "gordons green": (0x0B, 0x11, 0x07),
655     "gorse": (0xFF, 0xF1, 0x4F),
656     "gossamer": (0x06, 0x9B, 0x81),
657     "gossip": (0xD2, 0xF8, 0xB0),
658     "gothic": (0x6D, 0x92, 0xA1),
659     "governor bay": (0x2F, 0x3C, 0xB3),
660     "grain brown": (0xE4, 0xD5, 0xB7),
661     "grandis": (0xFF, 0xD3, 0x8C),
662     "granite green": (0x8D, 0x89, 0x74),
663     "granny apple": (0xD5, 0xF6, 0xE3),
664     "granny smith apple": (0x9D, 0xE0, 0x93),
665     "granny smith": (0x84, 0xA0, 0xA0),
666     "grape": (0x38, 0x1A, 0x51),
667     "graphite": (0x25, 0x16, 0x07),
668     "gravel": (0x4A, 0x44, 0x4B),
669     "gray asparagus": (0x46, 0x59, 0x45),
670     "gray chateau": (0xA2, 0xAA, 0xB3),
671     "gray nickel": (0xC3, 0xC3, 0xBD),
672     "gray nurse": (0xE7, 0xEC, 0xE6),
673     "gray olive": (0xA9, 0xA4, 0x91),
674     "gray suit": (0xC1, 0xBE, 0xCD),
675     "gray": (0x80, 0x80, 0x80),
676     "green haze": (0x01, 0xA3, 0x68),
677     "green house": (0x24, 0x50, 0x0F),
678     "green kelp": (0x25, 0x31, 0x1C),
679     "green leaf": (0x43, 0x6A, 0x0D),
680     "green mist": (0xCB, 0xD3, 0xB0),
681     "green pea": (0x1D, 0x61, 0x42),
682     "green smoke": (0xA4, 0xAF, 0x6E),
683     "green spring": (0xB8, 0xC1, 0xB1),
684     "green vogue": (0x03, 0x2B, 0x52),
685     "green waterloo": (0x10, 0x14, 0x05),
686     "green white": (0xE8, 0xEB, 0xE0),
687     "green yellow": (0xAD, 0xFF, 0x2F),
688     "green": (0x00, 0xFF, 0x00),
689     "grenadier": (0xD5, 0x46, 0x00),
690     "guardsman red": (0xBA, 0x01, 0x01),
691     "gulf blue": (0x05, 0x16, 0x57),
692     "gulf stream": (0x80, 0xB3, 0xAE),
693     "gull gray": (0x9D, 0xAC, 0xB7),
694     "gum leaf": (0xB6, 0xD3, 0xBF),
695     "gumbo": (0x7C, 0xA1, 0xA6),
696     "gun powder": (0x41, 0x42, 0x57),
697     "gunsmoke": (0x82, 0x86, 0x85),
698     "gurkha": (0x9A, 0x95, 0x77),
699     "hacienda": (0x98, 0x81, 0x1B),
700     "hairy heath": (0x6B, 0x2A, 0x14),
701     "haiti": (0x1B, 0x10, 0x35),
702     "half and half": (0xFF, 0xFE, 0xE1),
703     "half baked": (0x85, 0xC4, 0xCC),
704     "half colonial white": (0xFD, 0xF6, 0xD3),
705     "half dutch white": (0xFE, 0xF7, 0xDE),
706     "half spanish white": (0xFE, 0xF4, 0xDB),
707     "hampton": (0xE5, 0xD8, 0xAF),
708     "harlequin": (0x3F, 0xFF, 0x00),
709     "harp": (0xE6, 0xF2, 0xEA),
710     "harvest gold": (0xE0, 0xB9, 0x74),
711     "havelock blue": (0x55, 0x90, 0xD9),
712     "hawaiian tan": (0x9D, 0x56, 0x16),
713     "hawkes blue": (0xD4, 0xE2, 0xFC),
714     "heath": (0x54, 0x10, 0x12),
715     "heather": (0xB7, 0xC3, 0xD0),
716     "heathered gray": (0xB6, 0xB0, 0x95),
717     "heavy metal": (0x2B, 0x32, 0x28),
718     "heliotrope": (0xDF, 0x73, 0xFF),
719     "hemlock": (0x5E, 0x5D, 0x3B),
720     "hemp": (0x90, 0x78, 0x74),
721     "hibiscus": (0xB6, 0x31, 0x6C),
722     "highland": (0x6F, 0x8E, 0x63),
723     "hillary": (0xAC, 0xA5, 0x86),
724     "himalaya": (0x6A, 0x5D, 0x1B),
725     "hint of green": (0xE6, 0xFF, 0xE9),
726     "hint of red": (0xFB, 0xF9, 0xF9),
727     "hint of yellow": (0xFA, 0xFD, 0xE4),
728     "hippie blue": (0x58, 0x9A, 0xAF),
729     "hippie green": (0x53, 0x82, 0x4B),
730     "hippie pink": (0xAE, 0x45, 0x60),
731     "hit gray": (0xA1, 0xAD, 0xB5),
732     "hit pink": (0xFF, 0xAB, 0x81),
733     "hokey pokey": (0xC8, 0xA5, 0x28),
734     "hoki": (0x65, 0x86, 0x9F),
735     "holly": (0x01, 0x1D, 0x13),
736     "hollywood cerise": (0xF4, 0x00, 0xA1),
737     "honey flower": (0x4F, 0x1C, 0x70),
738     "honeydew": (0xF0, 0xFF, 0xF0),
739     "honeysuckle": (0xED, 0xFC, 0x84),
740     "hopbush": (0xD0, 0x6D, 0xA1),
741     "horizon": (0x5A, 0x87, 0xA0),
742     "horses neck": (0x60, 0x49, 0x13),
743     "hot cinnamon": (0xD2, 0x69, 0x1E),
744     "hot pink": (0xFF, 0x69, 0xB4),
745     "hot toddy": (0xB3, 0x80, 0x07),
746     "humming bird": (0xCF, 0xF9, 0xF3),
747     "hunter green": (0x16, 0x1D, 0x10),
748     "hurricane": (0x87, 0x7C, 0x7B),
749     "husk": (0xB7, 0xA4, 0x58),
750     "ice cold": (0xB1, 0xF4, 0xE7),
751     "iceberg": (0xDA, 0xF4, 0xF0),
752     "illusion": (0xF6, 0xA4, 0xC9),
753     "inch worm": (0xB0, 0xE3, 0x13),
754     "indian khaki": (0xC3, 0xB0, 0x91),
755     "indian red": (0xCD, 0x5C, 0x5C),
756     "indian tan": (0x4D, 0x1E, 0x01),
757     "indigo": (0x4F, 0x69, 0xC6),
758     "indochine": (0xC2, 0x6B, 0x03),
759     "international orange": (0xFF, 0x4F, 0x00),
760     "irish coffee": (0x5F, 0x3D, 0x26),
761     "iroko": (0x43, 0x31, 0x20),
762     "iron": (0xD4, 0xD7, 0xD9),
763     "ironside gray": (0x67, 0x66, 0x62),
764     "ironstone": (0x86, 0x48, 0x3C),
765     "island spice": (0xFF, 0xFC, 0xEE),
766     "ivory": (0xFF, 0xFF, 0xF0),
767     "jacaranda": (0x2E, 0x03, 0x29),
768     "jacarta": (0x3A, 0x2A, 0x6A),
769     "jacko bean": (0x2E, 0x19, 0x05),
770     "jacksons purple": (0x20, 0x20, 0x8D),
771     "jade": (0x00, 0xA8, 0x6B),
772     "jaffa": (0xEF, 0x86, 0x3F),
773     "jagged ice": (0xC2, 0xE8, 0xE5),
774     "jagger": (0x35, 0x0E, 0x57),
775     "jaguar": (0x08, 0x01, 0x10),
776     "jambalaya": (0x5B, 0x30, 0x13),
777     "janna": (0xF4, 0xEB, 0xD3),
778     "japanese laurel": (0x0A, 0x69, 0x06),
779     "japanese maple": (0x78, 0x01, 0x09),
780     "japonica": (0xD8, 0x7C, 0x63),
781     "java": (0x1F, 0xC2, 0xC2),
782     "jazzberry jam": (0xA5, 0x0B, 0x5E),
783     "jelly bean": (0x29, 0x7B, 0x9A),
784     "jet stream": (0xB5, 0xD2, 0xCE),
785     "jewel": (0x12, 0x6B, 0x40),
786     "jon": (0x3B, 0x1F, 0x1F),
787     "jonquil": (0xEE, 0xFF, 0x9A),
788     "jordy blue": (0x8A, 0xB9, 0xF1),
789     "judge gray": (0x54, 0x43, 0x33),
790     "jumbo": (0x7C, 0x7B, 0x82),
791     "jungle green": (0x29, 0xAB, 0x87),
792     "jungle mist": (0xB4, 0xCF, 0xD3),
793     "juniper": (0x6D, 0x92, 0x92),
794     "just right": (0xEC, 0xCD, 0xB9),
795     "kabul": (0x5E, 0x48, 0x3E),
796     "kaitoke green": (0x00, 0x46, 0x20),
797     "kangaroo": (0xC6, 0xC8, 0xBD),
798     "karaka": (0x1E, 0x16, 0x09),
799     "karry": (0xFF, 0xEA, 0xD4),
800     "kashmir blue": (0x50, 0x70, 0x96),
801     "kelp": (0x45, 0x49, 0x36),
802     "kenyan copper": (0x7C, 0x1C, 0x05),
803     "keppel": (0x3A, 0xB0, 0x9E),
804     "key lime pie": (0xBF, 0xC9, 0x21),
805     "khaki": (0xF0, 0xE6, 0x8C),
806     "kidnapper": (0xE1, 0xEA, 0xD4),
807     "kilamanjaro": (0x24, 0x0C, 0x02),
808     "killarney": (0x3A, 0x6A, 0x47),
809     "kimberly": (0x73, 0x6C, 0x9F),
810     "kingfisher daisy": (0x3E, 0x04, 0x80),
811     "kiosk.house": (90, 95, 0),
812     "klein blue": (0x00, 0x2F, 0xA7),
813     "kobi": (0xE7, 0x9F, 0xC4),
814     "kokoda": (0x6E, 0x6D, 0x57),
815     "korma": (0x8F, 0x4B, 0x0E),
816     "koromiko": (0xFF, 0xBD, 0x5F),
817     "kournikova": (0xFF, 0xE7, 0x72),
818     "kumera": (0x88, 0x62, 0x21),
819     "la palma": (0x36, 0x87, 0x16),
820     "la rioja": (0xB3, 0xC1, 0x10),
821     "las palmas": (0xC6, 0xE6, 0x10),
822     "laser lemon": (0xFF, 0xFF, 0x66),
823     "laser": (0xC8, 0xB5, 0x68),
824     "laurel": (0x74, 0x93, 0x78),
825     "lavender blush": (0xFF, 0xF0, 0xF5),
826     "lavender gray": (0xBD, 0xBB, 0xD7),
827     "lavender magenta": (0xEE, 0x82, 0xEE),
828     "lavender pink": (0xFB, 0xAE, 0xD2),
829     "lavender purple": (0x96, 0x7B, 0xB6),
830     "lavender rose": (0xFB, 0xA0, 0xE3),
831     "lavender": (0xB5, 0x7E, 0xDC),
832     "lawn green": (0x7C, 0xFC, 0x00),
833     "leather": (0x96, 0x70, 0x59),
834     "lemon chiffon": (0xFF, 0xFA, 0xCD),
835     "lemon ginger": (0xAC, 0x9E, 0x22),
836     "lemon grass": (0x9B, 0x9E, 0x8F),
837     "lemon": (0xFD, 0xE9, 0x10),
838     "light apricot": (0xFD, 0xD5, 0xB1),
839     "light blue": (0xAD, 0xD8, 0xE6),
840     "light coral": (0xF0, 0x80, 0x80),
841     "light cyan": (0xE0, 0xFF, 0xFF),
842     "light goldenrod": (0xFA, 0xFA, 0xD2),
843     "light gray": (0x26, 0x23, 0x35),
844     "light green": (0x90, 0xEE, 0x90),
845     "light orchid": (0xE2, 0x9C, 0xD2),
846     "light pink": (0xDD, 0xB6, 0xC1),
847     "light salmon": (0xDD, 0xA0, 0x7A),
848     "light sea green": (0x20, 0xB2, 0xAA),
849     "light slate gray": (0x77, 0x88, 0x99),
850     "light steel blue": (0xB0, 0xC4, 0xDE),
851     "light wisteria": (0xC9, 0xA0, 0xDC),
852     "light yellow": (0xFF, 0xFF, 0xE0),
853     "lightning yellow": (0xFC, 0xC0, 0x1E),
854     "lilac bush": (0x98, 0x74, 0xD3),
855     "lilac": (0xC8, 0xA2, 0xC8),
856     "lily white": (0xE7, 0xF8, 0xFF),
857     "lily": (0xC8, 0xAA, 0xBF),
858     "lima": (0x76, 0xBD, 0x17),
859     "lime": (0xBF, 0xFF, 0x00),
860     "limeade": (0x6F, 0x9D, 0x02),
861     "limed ash": (0x74, 0x7D, 0x63),
862     "limed oak": (0xAC, 0x8A, 0x56),
863     "limed spruce": (0x39, 0x48, 0x51),
864     "linen": (0xFA, 0xF0, 0xE6),
865     "link water": (0xD9, 0xE4, 0xF5),
866     "lipstick": (0xAB, 0x05, 0x63),
867     "lisbon brown": (0x42, 0x39, 0x21),
868     "livid brown": (0x4D, 0x28, 0x2E),
869     "loafer": (0xEE, 0xF4, 0xDE),
870     "loblolly": (0xBD, 0xC9, 0xCE),
871     "lochinvar": (0x2C, 0x8C, 0x84),
872     "lochmara": (0x00, 0x7E, 0xC7),
873     "locust": (0xA8, 0xAF, 0x8E),
874     "log cabin": (0x24, 0x2A, 0x1D),
875     "logan": (0xAA, 0xA9, 0xCD),
876     "lola": (0xDF, 0xCF, 0xDB),
877     "london hue": (0xBE, 0xA6, 0xC3),
878     "lonestar": (0x6D, 0x01, 0x01),
879     "lotus": (0x86, 0x3C, 0x3C),
880     "loulou": (0x46, 0x0B, 0x41),
881     "lucky point": (0x1A, 0x1A, 0x68),
882     "lucky": (0xAF, 0x9F, 0x1C),
883     "lunar green": (0x3C, 0x49, 0x3A),
884     "luxor gold": (0xA7, 0x88, 0x2C),
885     "lynch": (0x69, 0x7E, 0x9A),
886     "mabel": (0xD9, 0xF7, 0xFF),
887     "macaroni and cheese": (0xFF, 0xB9, 0x7B),
888     "madang": (0xB7, 0xF0, 0xBE),
889     "madison": (0x09, 0x25, 0x5D),
890     "madras": (0x3F, 0x30, 0x02),
891     "magenta": (0xFF, 0x00, 0xFF),
892     "magic mint": (0xAA, 0xF0, 0xD1),
893     "magnolia": (0xF8, 0xF4, 0xFF),
894     "mahogany": (0x4E, 0x06, 0x06),
895     "mai tai": (0xB0, 0x66, 0x08),
896     "maize": (0xF5, 0xD5, 0xA0),
897     "makara": (0x89, 0x7D, 0x6D),
898     "mako": (0x44, 0x49, 0x54),
899     "malachite": (0x0B, 0xDA, 0x51),
900     "malibu": (0x7D, 0xC8, 0xF7),
901     "mallard": (0x23, 0x34, 0x18),
902     "malta": (0xBD, 0xB2, 0xA1),
903     "mamba": (0x8E, 0x81, 0x90),
904     "manatee": (0x8D, 0x90, 0xA1),
905     "mandalay": (0xAD, 0x78, 0x1B),
906     "mandy": (0xE2, 0x54, 0x65),
907     "mandys pink": (0xF2, 0xC3, 0xB2),
908     "mango tango": (0xE7, 0x72, 0x00),
909     "manhattan": (0xF5, 0xC9, 0x99),
910     "mantis": (0x74, 0xC3, 0x65),
911     "mantle": (0x8B, 0x9C, 0x90),
912     "manz": (0xEE, 0xEF, 0x78),
913     "mardi gras": (0x35, 0x00, 0x36),
914     "marigold yellow": (0xFB, 0xE8, 0x70),
915     "marigold": (0xB9, 0x8D, 0x28),
916     "mariner": (0x28, 0x6A, 0xCD),
917     "maroon flush": (0xC3, 0x21, 0x48),
918     "maroon oak": (0x52, 0x0C, 0x17),
919     "maroon": (0x80, 0x00, 0x00),
920     "marshland": (0x0B, 0x0F, 0x08),
921     "martini": (0xAF, 0xA0, 0x9E),
922     "martinique": (0x36, 0x30, 0x50),
923     "marzipan": (0xF8, 0xDB, 0x9D),
924     "masala": (0x40, 0x3B, 0x38),
925     "matisse": (0x1B, 0x65, 0x9D),
926     "matrix": (0xB0, 0x5D, 0x54),
927     "matterhorn": (0x4E, 0x3B, 0x41),
928     "mauve": (0xE0, 0xB0, 0xFF),
929     "mauvelous": (0xF0, 0x91, 0xA9),
930     "maverick": (0xD8, 0xC2, 0xD5),
931     "medium aquamarine": (0x66, 0xCD, 0xAA),
932     "medium blue": (0x00, 0x00, 0xCD),
933     "medium carmine": (0xAF, 0x40, 0x35),
934     "medium orchid": (0xBA, 0x55, 0xD3),
935     "medium purple": (0x93, 0x70, 0xDB),
936     "medium red violet": (0xBB, 0x33, 0x85),
937     "medium sea green": (0x3C, 0xB3, 0x71),
938     "medium slate blue": (0x7B, 0x68, 0xEE),
939     "medium spring green": (0x00, 0xFA, 0x9A),
940     "medium turquoise": (0x48, 0xD1, 0xCC),
941     "medium violet red": (0xC7, 0x15, 0x85),
942     "meerkat.cabin": (95, 0x00, 95),
943     "melanie": (0xE4, 0xC2, 0xD5),
944     "melanzane": (0x30, 0x05, 0x29),
945     "melon": (0xFE, 0xBA, 0xAD),
946     "melrose": (0xC7, 0xC1, 0xFF),
947     "mercury": (0xE5, 0xE5, 0xE5),
948     "merino": (0xF6, 0xF0, 0xE6),
949     "merlin": (0x41, 0x3C, 0x37),
950     "merlot": (0x83, 0x19, 0x23),
951     "metallic bronze": (0x49, 0x37, 0x1B),
952     "metallic copper": (0x71, 0x29, 0x1D),
953     "meteor": (0xD0, 0x7D, 0x12),
954     "meteorite": (0x3C, 0x1F, 0x76),
955     "mexican red": (0xA7, 0x25, 0x25),
956     "mid gray": (0x5F, 0x5F, 0x6E),
957     "midnight blue": (0x00, 0x33, 0x66),
958     "midnight moss": (0x04, 0x10, 0x04),
959     "midnight": (0x01, 0x16, 0x35),
960     "mikado": (0x2D, 0x25, 0x10),
961     "milan": (0xFA, 0xFF, 0xA4),
962     "milano red": (0xB8, 0x11, 0x04),
963     "milk punch": (0xFF, 0xF6, 0xD4),
964     "millbrook": (0x59, 0x44, 0x33),
965     "mimosa": (0xF8, 0xFD, 0xD3),
966     "mindaro": (0xE3, 0xF9, 0x88),
967     "mine shaft": (0x32, 0x32, 0x32),
968     "mineral green": (0x3F, 0x5D, 0x53),
969     "ming": (0x36, 0x74, 0x7D),
970     "minsk": (0x3F, 0x30, 0x7F),
971     "mint cream": (0xF5, 0xFF, 0xF1),
972     "mint green": (0x98, 0xFF, 0x98),
973     "mint julep": (0xF1, 0xEE, 0xC1),
974     "mint tulip": (0xC4, 0xF4, 0xEB),
975     "mirage": (0x16, 0x19, 0x28),
976     "mischka": (0xD1, 0xD2, 0xDD),
977     "mist gray": (0xC4, 0xC4, 0xBC),
978     "misty rose": (0xFF, 0xE4, 0xE1),
979     "mobster": (0x7F, 0x75, 0x89),
980     "moccaccino": (0x6E, 0x1D, 0x14),
981     "moccasin": (0xFF, 0xE4, 0xB5),
982     "mocha": (0x78, 0x2D, 0x19),
983     "mojo": (0xC0, 0x47, 0x37),
984     "mona lisa": (0xFF, 0xA1, 0x94),
985     "monarch": (0x8B, 0x07, 0x23),
986     "mondo": (0x4A, 0x3C, 0x30),
987     "mongoose": (0xB5, 0xA2, 0x7F),
988     "monsoon": (0x8A, 0x83, 0x89),
989     "monte carlo": (0x83, 0xD0, 0xC6),
990     "monza": (0xC7, 0x03, 0x1E),
991     "moody blue": (0x7F, 0x76, 0xD3),
992     "moon glow": (0xFC, 0xFE, 0xDA),
993     "moon mist": (0xDC, 0xDD, 0xCC),
994     "moon raker": (0xD6, 0xCE, 0xF6),
995     "morning glory": (0x9E, 0xDE, 0xE0),
996     "morocco brown": (0x44, 0x1D, 0x00),
997     "mortar": (0x50, 0x43, 0x51),
998     "mosque": (0x03, 0x6A, 0x6E),
999     "moss green": (0xAD, 0xDF, 0xAD),
1000     "mountain meadow": (0x1A, 0xB3, 0x85),
1001     "mountain mist": (0x95, 0x93, 0x96),
1002     "mountbatten pink": (0x99, 0x7A, 0x8D),
1003     "muddy waters": (0xB7, 0x8E, 0x5C),
1004     "muesli": (0xAA, 0x8B, 0x5B),
1005     "mulberry wood": (0x5C, 0x05, 0x36),
1006     "mulberry": (0xC5, 0x4B, 0x8C),
1007     "mule fawn": (0x8C, 0x47, 0x2F),
1008     "mulled wine": (0x4E, 0x45, 0x62),
1009     "mustard": (0xFF, 0xDB, 0x58),
1010     "my pink": (0xD6, 0x91, 0x88),
1011     "my sin": (0xFF, 0xB3, 0x1F),
1012     "mystic": (0xE2, 0xEB, 0xED),
1013     "nandor": (0x4B, 0x5D, 0x52),
1014     "napa": (0xAC, 0xA4, 0x94),
1015     "narvik": (0xED, 0xF9, 0xF1),
1016     "natural gray": (0x8B, 0x86, 0x80),
1017     "navajo white": (0xFF, 0xDE, 0xAD),
1018     "navy blue": (0x00, 0x00, 0x80),
1019     "navy": (0x00, 0x00, 0x80),
1020     "nebula": (0xCB, 0xDB, 0xD6),
1021     "negroni": (0xFF, 0xE2, 0xC5),
1022     "neon carrot": (0xFF, 0x99, 0x33),
1023     "nepal": (0x8E, 0xAB, 0xC1),
1024     "neptune": (0x7C, 0xB7, 0xBB),
1025     "nero": (0x14, 0x06, 0x00),
1026     "nevada": (0x64, 0x6E, 0x75),
1027     "new orleans": (0xF3, 0xD6, 0x9D),
1028     "new york pink": (0xD7, 0x83, 0x7F),
1029     "niagara": (0x06, 0xA1, 0x89),
1030     "night rider": (0x1F, 0x12, 0x0F),
1031     "night shadz": (0xAA, 0x37, 0x5A),
1032     "nile blue": (0x19, 0x37, 0x51),
1033     "nobel": (0xB7, 0xB1, 0xB1),
1034     "nomad": (0xBA, 0xB1, 0xA2),
1035     "norway": (0xA8, 0xBD, 0x9F),
1036     "nugget": (0xC5, 0x99, 0x22),
1037     "nutmeg wood finish": (0x68, 0x36, 0x00),
1038     "nutmeg": (0x81, 0x42, 0x2C),
1039     "oasis": (0xFE, 0xEF, 0xCE),
1040     "observatory": (0x02, 0x86, 0x6F),
1041     "ocean green": (0x41, 0xAA, 0x78),
1042     "ochre": (0xCC, 0x77, 0x22),
1043     "off green": (0xE6, 0xF8, 0xF3),
1044     "off yellow": (0xFE, 0xF9, 0xE3),
1045     "oil": (0x28, 0x1E, 0x15),
1046     "old brick": (0x90, 0x1E, 0x1E),
1047     "old copper": (0x72, 0x4A, 0x2F),
1048     "old gold": (0xCF, 0xB5, 0x3B),
1049     "old lace": (0xFD, 0xF5, 0xE6),
1050     "old lavender": (0x79, 0x68, 0x78),
1051     "old rose": (0xC0, 0x80, 0x81),
1052     "olive drab": (0x6B, 0x8E, 0x23),
1053     "olive green": (0xB5, 0xB3, 0x5C),
1054     "olive haze": (0x8B, 0x84, 0x70),
1055     "olive": (0x80, 0x80, 0x00),
1056     "olivetone": (0x71, 0x6E, 0x10),
1057     "olivine": (0x9A, 0xB9, 0x73),
1058     "onahau": (0xCD, 0xF4, 0xFF),
1059     "onion": (0x2F, 0x27, 0x0E),
1060     "opal": (0xA9, 0xC6, 0xC2),
1061     "opium": (0x8E, 0x6F, 0x70),
1062     "oracle": (0x37, 0x74, 0x75),
1063     "orange peel": (0xFF, 0xA0, 0x00),
1064     "orange red": (0xFF, 0x45, 0x00),
1065     "orange roughy": (0xC4, 0x57, 0x19),
1066     "orange white": (0xFE, 0xFC, 0xED),
1067     "orange": (0xFF, 0x68, 0x1F),
1068     "orchid white": (0xFF, 0xFD, 0xF3),
1069     "orchid": (0xDA, 0x70, 0xD6),
1070     "oregon": (0x9B, 0x47, 0x03),
1071     "orient": (0x01, 0x5E, 0x85),
1072     "oriental pink": (0xC6, 0x91, 0x91),
1073     "orinoco": (0xF3, 0xFB, 0xD4),
1074     "oslo gray": (0x87, 0x8D, 0x91),
1075     "ottoman": (0xE9, 0xF8, 0xED),
1076     "outer space": (0x2D, 0x38, 0x3A),
1077     "outrageous orange": (0xFF, 0x60, 0x37),
1078     "oxford blue": (0x38, 0x45, 0x55),
1079     "oxley": (0x77, 0x9E, 0x86),
1080     "oyster bay": (0xDA, 0xFA, 0xFF),
1081     "oyster pink": (0xE9, 0xCE, 0xCD),
1082     "paarl": (0xA6, 0x55, 0x29),
1083     "pablo": (0x77, 0x6F, 0x61),
1084     "pacific blue": (0x00, 0x9D, 0xC4),
1085     "pacifika": (0x77, 0x81, 0x20),
1086     "paco": (0x41, 0x1F, 0x10),
1087     "padua": (0xAD, 0xE6, 0xC4),
1088     "pale canary": (0xFF, 0xFF, 0x99),
1089     "pale goldenrod": (0xEE, 0xE8, 0xAA),
1090     "pale green": (0x98, 0xFB, 0x98),
1091     "pale leaf": (0xC0, 0xD3, 0xB9),
1092     "pale oyster": (0x98, 0x8D, 0x77),
1093     "pale prim": (0xFD, 0xFE, 0xB8),
1094     "pale rose": (0xFF, 0xE1, 0xF2),
1095     "pale sky": (0x6E, 0x77, 0x83),
1096     "pale slate": (0xC3, 0xBF, 0xC1),
1097     "pale turquoise": (0xAF, 0xEE, 0xEE),
1098     "pale violet red": (0xDB, 0x70, 0x93),
1099     "palm green": (0x09, 0x23, 0x0F),
1100     "palm leaf": (0x19, 0x33, 0x0E),
1101     "pampas": (0xF4, 0xF2, 0xEE),
1102     "panache": (0xEA, 0xF6, 0xEE),
1103     "pancho": (0xED, 0xCD, 0xAB),
1104     "papaya whip": (0xFF, 0xEF, 0xD5),
1105     "paprika": (0x8D, 0x02, 0x26),
1106     "paradiso": (0x31, 0x7D, 0x82),
1107     "parchment": (0xF1, 0xE9, 0xD2),
1108     "paris daisy": (0xFF, 0xF4, 0x6E),
1109     "paris m": (0x26, 0x05, 0x6A),
1110     "paris white": (0xCA, 0xDC, 0xD4),
1111     "parsley": (0x13, 0x4F, 0x19),
1112     "pastel green": (0x77, 0xDD, 0x77),
1113     "pastel pink": (0xFF, 0xD1, 0xDC),
1114     "patina": (0x63, 0x9A, 0x8F),
1115     "pattens blue": (0xDE, 0xF5, 0xFF),
1116     "paua": (0x26, 0x03, 0x68),
1117     "pavlova": (0xD7, 0xC4, 0x98),
1118     "peach cream": (0xFF, 0xF0, 0xDB),
1119     "peach orange": (0xFF, 0xCC, 0x99),
1120     "peach puff": (0xFF, 0xDA, 0xB9),
1121     "peach schnapps": (0xFF, 0xDC, 0xD6),
1122     "peach yellow": (0xFA, 0xDF, 0xAD),
1123     "peach": (0xFF, 0xE5, 0xB4),
1124     "peanut": (0x78, 0x2F, 0x16),
1125     "pear": (0xD1, 0xE2, 0x31),
1126     "pearl bush": (0xE8, 0xE0, 0xD5),
1127     "pearl lusta": (0xFC, 0xF4, 0xDC),
1128     "peat": (0x71, 0x6B, 0x56),
1129     "pelorous": (0x3E, 0xAB, 0xBF),
1130     "peppermint": (0xE3, 0xF5, 0xE1),
1131     "perano": (0xA9, 0xBE, 0xF2),
1132     "perfume": (0xD0, 0xBE, 0xF8),
1133     "periglacial blue": (0xE1, 0xE6, 0xD6),
1134     "periwinkle gray": (0xC3, 0xCD, 0xE6),
1135     "periwinkle": (0xCC, 0xCC, 0xFF),
1136     "persian blue": (0x1C, 0x39, 0xBB),
1137     "persian green": (0x00, 0xA6, 0x93),
1138     "persian indigo": (0x32, 0x12, 0x7A),
1139     "persian pink": (0xF7, 0x7F, 0xBE),
1140     "persian plum": (0x70, 0x1C, 0x1C),
1141     "persian red": (0xCC, 0x33, 0x33),
1142     "persian rose": (0xFE, 0x28, 0xA2),
1143     "persimmon": (0xFF, 0x6B, 0x53),
1144     "peru tan": (0x7F, 0x3A, 0x02),
1145     "peru": (0xCD, 0x85, 0x3F),
1146     "pesto": (0x7C, 0x76, 0x31),
1147     "petite orchid": (0xDB, 0x96, 0x90),
1148     "pewter": (0x96, 0xA8, 0xA1),
1149     "pharlap": (0xA3, 0x80, 0x7B),
1150     "picasso": (0xFF, 0xF3, 0x9D),
1151     "pickled bean": (0x6E, 0x48, 0x26),
1152     "pickled bluewood": (0x31, 0x44, 0x59),
1153     "picton blue": (0x45, 0xB1, 0xE8),
1154     "pig pink": (0xFD, 0xD7, 0xE4),
1155     "pigeon post": (0xAF, 0xBD, 0xD9),
1156     "pigment indigo": (0x4B, 0x00, 0x82),
1157     "pine cone": (0x6D, 0x5E, 0x54),
1158     "pine glade": (0xC7, 0xCD, 0x90),
1159     "pine green": (0x01, 0x79, 0x6F),
1160     "pine tree": (0x17, 0x1F, 0x04),
1161     "pink flamingo": (0xFF, 0x66, 0xFF),
1162     "pink flare": (0xE1, 0xC0, 0xC8),
1163     "pink lace": (0xFF, 0xDD, 0xF4),
1164     "pink lady": (0xFF, 0xF1, 0xD8),
1165     "pink salmon": (0xFF, 0x91, 0xA4),
1166     "pink swan": (0xBE, 0xB5, 0xB7),
1167     "pink": (0xFF, 0xC0, 0xCB),
1168     "piper": (0xC9, 0x63, 0x23),
1169     "pipi": (0xFE, 0xF4, 0xCC),
1170     "pippin": (0xFF, 0xE1, 0xDF),
1171     "pirate gold": (0xBA, 0x7F, 0x03),
1172     "pistachio": (0x9D, 0xC2, 0x09),
1173     "pixie green": (0xC0, 0xD8, 0xB6),
1174     "pizazz": (0xFF, 0x90, 0x00),
1175     "pizza": (0xC9, 0x94, 0x15),
1176     "plantation": (0x27, 0x50, 0x4B),
1177     "plum": (0x84, 0x31, 0x79),
1178     "pohutukawa": (0x8F, 0x02, 0x1C),
1179     "polar": (0xE5, 0xF9, 0xF6),
1180     "polo blue": (0x8D, 0xA8, 0xCC),
1181     "pomegranate": (0xF3, 0x47, 0x23),
1182     "pompadour": (0x66, 0x00, 0x45),
1183     "porcelain": (0xEF, 0xF2, 0xF3),
1184     "porsche": (0xEA, 0xAE, 0x69),
1185     "port gore": (0x25, 0x1F, 0x4F),
1186     "portafino": (0xFF, 0xFF, 0xB4),
1187     "portage": (0x8B, 0x9F, 0xEE),
1188     "portica": (0xF9, 0xE6, 0x63),
1189     "pot pourri": (0xF5, 0xE7, 0xE2),
1190     "potters clay": (0x8C, 0x57, 0x38),
1191     "powder ash": (0xBC, 0xC9, 0xC2),
1192     "powder blue": (0xB0, 0xE0, 0xE6),
1193     "prairie sand": (0x9A, 0x38, 0x20),
1194     "prelude": (0xD0, 0xC0, 0xE5),
1195     "prim": (0xF0, 0xE2, 0xEC),
1196     "primrose": (0xED, 0xEA, 0x99),
1197     "provincial pink": (0xFE, 0xF5, 0xF1),
1198     "prussian blue": (0x00, 0x31, 0x53),
1199     "puce": (0xCC, 0x88, 0x99),
1200     "pueblo": (0x7D, 0x2C, 0x14),
1201     "puerto rico": (0x3F, 0xC1, 0xAA),
1202     "pumice": (0xC2, 0xCA, 0xC4),
1203     "pumpkin skin": (0xB1, 0x61, 0x0B),
1204     "pumpkin": (0xFF, 0x75, 0x18),
1205     "punch": (0xDC, 0x43, 0x33),
1206     "punga": (0x4D, 0x3D, 0x14),
1207     "purple heart": (0x65, 0x2D, 0xC1),
1208     "purple mountain's majesty": (0x96, 0x78, 0xB6),
1209     "purple pizzazz": (0xFF, 0x00, 0xCC),
1210     "purple": (0x66, 0x00, 0x99),
1211     "putty": (0xE7, 0xCD, 0x8C),
1212     "quarter pearl lusta": (0xFF, 0xFD, 0xF4),
1213     "quarter spanish white": (0xF7, 0xF2, 0xE1),
1214     "quicksand": (0xBD, 0x97, 0x8E),
1215     "quill gray": (0xD6, 0xD6, 0xD1),
1216     "quincy": (0x62, 0x3F, 0x2D),
1217     "racing green": (0x0C, 0x19, 0x11),
1218     "radical red": (0xFF, 0x35, 0x5E),
1219     "raffia": (0xEA, 0xDA, 0xB8),
1220     "rainee": (0xB9, 0xC8, 0xAC),
1221     "rajah": (0xF7, 0xB6, 0x68),
1222     "rangitoto": (0x2E, 0x32, 0x22),
1223     "rangoon green": (0x1C, 0x1E, 0x13),
1224     "raven": (0x72, 0x7B, 0x89),
1225     "raw sienna": (0xD2, 0x7D, 0x46),
1226     "raw umber": (0x73, 0x4A, 0x12),
1227     "razzle dazzle rose": (0xFF, 0x33, 0xCC),
1228     "razzmatazz": (0xE3, 0x0B, 0x5C),
1229     "rebecca purple": (0x66, 0x33, 0x99),
1230     "rebel": (0x3C, 0x12, 0x06),
1231     "red beech": (0x7B, 0x38, 0x01),
1232     "red berry": (0x8E, 0x00, 0x00),
1233     "red damask": (0xDA, 0x6A, 0x41),
1234     "red devil": (0x86, 0x01, 0x11),
1235     "red orange": (0xFF, 0x3F, 0x34),
1236     "red oxide": (0x6E, 0x09, 0x02),
1237     "red ribbon": (0xED, 0x0A, 0x3F),
1238     "red robin": (0x80, 0x34, 0x1F),
1239     "red stage": (0xD0, 0x5F, 0x04),
1240     "red violet": (0xC7, 0x15, 0x85),
1241     "red": (0xFF, 0x00, 0x00),
1242     "redwood": (0x5D, 0x1E, 0x0F),
1243     "reef gold": (0x9F, 0x82, 0x1C),
1244     "reef": (0xC9, 0xFF, 0xA2),
1245     "regal blue": (0x01, 0x3F, 0x6A),
1246     "regent gray": (0x86, 0x94, 0x9F),
1247     "regent st blue": (0xAA, 0xD6, 0xE6),
1248     "remy": (0xFE, 0xEB, 0xF3),
1249     "reno sand": (0xA8, 0x65, 0x15),
1250     "resolution blue": (0x00, 0x23, 0x87),
1251     "revolver": (0x2C, 0x16, 0x32),
1252     "rhino": (0x2E, 0x3F, 0x62),
1253     "rice cake": (0xFF, 0xFE, 0xF0),
1254     "rice flower": (0xEE, 0xFF, 0xE2),
1255     "rich gold": (0xA8, 0x53, 0x07),
1256     "rio grande": (0xBB, 0xD0, 0x09),
1257     "ripe lemon": (0xF4, 0xD8, 0x1C),
1258     "ripe plum": (0x41, 0x00, 0x56),
1259     "riptide": (0x8B, 0xE6, 0xD8),
1260     "river bed": (0x43, 0x4C, 0x59),
1261     "rob roy": (0xEA, 0xC6, 0x74),
1262     "robin's egg blue": (0x00, 0xCC, 0xCC),
1263     "rock blue": (0x9E, 0xB1, 0xCD),
1264     "rock spray": (0xBA, 0x45, 0x0C),
1265     "rock": (0x4D, 0x38, 0x33),
1266     "rodeo dust": (0xC9, 0xB2, 0x9B),
1267     "rolling stone": (0x74, 0x7D, 0x83),
1268     "roman coffee": (0x79, 0x5D, 0x4C),
1269     "roman": (0xDE, 0x63, 0x60),
1270     "romance": (0xFF, 0xFE, 0xFD),
1271     "romantic": (0xFF, 0xD2, 0xB7),
1272     "ronchi": (0xEC, 0xC5, 0x4E),
1273     "roof terracotta": (0xA6, 0x2F, 0x20),
1274     "rope": (0x8E, 0x4D, 0x1E),
1275     "rose bud cherry": (0x80, 0x0B, 0x47),
1276     "rose bud": (0xFB, 0xB2, 0xA3),
1277     "rose fog": (0xE7, 0xBC, 0xB4),
1278     "rose of sharon": (0xBF, 0x55, 0x00),
1279     "rose white": (0xFF, 0xF6, 0xF5),
1280     "rose": (0xFF, 0x00, 0x7F),
1281     "rosewood": (0x65, 0x00, 0x0B),
1282     "rosy blue": (0xBC, 0x8F, 0x8F),
1283     "roti": (0xC6, 0xA8, 0x4B),
1284     "rouge": (0xA2, 0x3B, 0x6C),
1285     "royal blue": (0x41, 0x69, 0xE1),
1286     "royal heath": (0xAB, 0x34, 0x72),
1287     "royal purple": (0x6B, 0x3F, 0xA0),
1288     "rpi": (208, 95, 0),
1289     "rum swizzle": (0xF9, 0xF8, 0xE4),
1290     "rum": (0x79, 0x69, 0x89),
1291     "russet": (0x80, 0x46, 0x1B),
1292     "russett": (0x75, 0x5A, 0x57),
1293     "rust": (0xB7, 0x41, 0x0E),
1294     "rustic red": (0x48, 0x04, 0x04),
1295     "rusty nail": (0x86, 0x56, 0x0A),
1296     "saddle brown": (0x58, 0x34, 0x01),
1297     "saddle": (0x4C, 0x30, 0x24),
1298     "saffron mango": (0xF9, 0xBF, 0x58),
1299     "saffron": (0xF4, 0xC4, 0x30),
1300     "sage": (0x9E, 0xA5, 0x87),
1301     "sahara sand": (0xF1, 0xE7, 0x88),
1302     "sahara": (0xB7, 0xA2, 0x14),
1303     "sail": (0xB8, 0xE0, 0xF9),
1304     "salem": (0x09, 0x7F, 0x4B),
1305     "salmon": (0xFF, 0x8C, 0x69),
1306     "salomie": (0xFE, 0xDB, 0x8D),
1307     "salt box": (0x68, 0x5E, 0x6E),
1308     "saltpan": (0xF1, 0xF7, 0xF2),
1309     "sambuca": (0x3A, 0x20, 0x10),
1310     "san felix": (0x0B, 0x62, 0x07),
1311     "san juan": (0x30, 0x4B, 0x6A),
1312     "san marino": (0x45, 0x6C, 0xAC),
1313     "sand dune": (0x82, 0x6F, 0x65),
1314     "sandal": (0xAA, 0x8D, 0x6F),
1315     "sandrift": (0xAB, 0x91, 0x7A),
1316     "sandstone": (0x79, 0x6D, 0x62),
1317     "sandwisp": (0xF5, 0xE7, 0xA2),
1318     "sandy beach": (0xFF, 0xEA, 0xC8),
1319     "sandy brown": (0xF4, 0xA4, 0x60),
1320     "sangria": (0x92, 0x00, 0x0A),
1321     "sanguine brown": (0x8D, 0x3D, 0x38),
1322     "santa fe": (0xB1, 0x6D, 0x52),
1323     "santas gray": (0x9F, 0xA0, 0xB1),
1324     "sapling": (0xDE, 0xD4, 0xA4),
1325     "sapphire": (0x2F, 0x51, 0x9E),
1326     "saratoga": (0x55, 0x5B, 0x10),
1327     "satin linen": (0xE6, 0xE4, 0xD4),
1328     "sauvignon": (0xFF, 0xF5, 0xF3),
1329     "sazerac": (0xFF, 0xF4, 0xE0),
1330     "scampi": (0x67, 0x5F, 0xA6),
1331     "scandal": (0xCF, 0xFA, 0xF4),
1332     "scarlet gum": (0x43, 0x15, 0x60),
1333     "scarlet": (0xFF, 0x24, 0x00),
1334     "scarlett": (0x95, 0x00, 0x15),
1335     "scarpa flow": (0x58, 0x55, 0x62),
1336     "schist": (0xA9, 0xB4, 0x97),
1337     "school bus yellow": (0xFF, 0xD8, 0x00),
1338     "schooner": (0x8B, 0x84, 0x7E),
1339     "science blue": (0x00, 0x66, 0xCC),
1340     "scooter": (0x2E, 0xBF, 0xD4),
1341     "scorpion": (0x69, 0x5F, 0x62),
1342     "scotch mist": (0xFF, 0xFB, 0xDC),
1343     "screamin' green": (0x66, 0xFF, 0x66),
1344     "screamin green": (0x66, 0xFF, 0x66),
1345     "screaming green": (0x66, 0xFF, 0x66),
1346     "sea buckthorn": (0xFB, 0xA1, 0x29),
1347     "sea green": (0x2E, 0x8B, 0x57),
1348     "sea mist": (0xC5, 0xDB, 0xCA),
1349     "sea nymph": (0x78, 0xA3, 0x9C),
1350     "sea pink": (0xED, 0x98, 0x9E),
1351     "seagull": (0x80, 0xCC, 0xEA),
1352     "seance": (0x73, 0x1E, 0x8F),
1353     "seashell peach": (0xFF, 0xF5, 0xEE),
1354     "seashell": (0xF1, 0xF1, 0xF1),
1355     "seaweed": (0x1B, 0x2F, 0x11),
1356     "selago": (0xF0, 0xEE, 0xFD),
1357     "selective yellow": (0xFF, 0xBA, 0x00),
1358     "sepia black": (0x2B, 0x02, 0x02),
1359     "sepia skin": (0x9E, 0x5B, 0x40),
1360     "sepia": (0x70, 0x42, 0x14),
1361     "serenade": (0xFF, 0xF4, 0xE8),
1362     "shadow green": (0x9A, 0xC2, 0xB8),
1363     "shadow": (0x83, 0x70, 0x50),
1364     "shady lady": (0xAA, 0xA5, 0xA9),
1365     "shakespeare": (0x4E, 0xAB, 0xD1),
1366     "shalimar": (0xFB, 0xFF, 0xBA),
1367     "shamrock": (0x33, 0xCC, 0x99),
1368     "shark": (0x25, 0x27, 0x2C),
1369     "sherpa blue": (0x00, 0x49, 0x50),
1370     "sherwood green": (0x02, 0x40, 0x2C),
1371     "shilo": (0xE8, 0xB9, 0xB3),
1372     "shingle fawn": (0x6B, 0x4E, 0x31),
1373     "ship cove": (0x78, 0x8B, 0xBA),
1374     "ship gray": (0x3E, 0x3A, 0x44),
1375     "shiraz": (0xB2, 0x09, 0x31),
1376     "shocking pink": (0xFC, 0x0F, 0xC0),
1377     "shocking": (0xE2, 0x92, 0xC0),
1378     "shuttle gray": (0x5F, 0x66, 0x72),
1379     "siam": (0x64, 0x6A, 0x54),
1380     "sidecar": (0xF3, 0xE7, 0xBB),
1381     "sienna": (0xA0, 0x52, 0x2D),
1382     "silk": (0xBD, 0xB1, 0xA8),
1383     "silver chalice": (0xAC, 0xAC, 0xAC),
1384     "silver rust": (0xC9, 0xC0, 0xBB),
1385     "silver sand": (0xBF, 0xC1, 0xC2),
1386     "silver tree": (0x66, 0xB5, 0x8F),
1387     "silver": (0xC0, 0xC0, 0xC0),
1388     "sinbad": (0x9F, 0xD7, 0xD3),
1389     "siren": (0x7A, 0x01, 0x3A),
1390     "sirocco": (0x71, 0x80, 0x80),
1391     "sisal": (0xD3, 0xCB, 0xBA),
1392     "skeptic": (0xCA, 0xE6, 0xDA),
1393     "sky blue": (0x76, 0xD7, 0xEA),
1394     "slate blue": (0x6A, 0x5A, 0xCD),
1395     "slate gray": (0x70, 0x80, 0x90),
1396     "smalt blue": (0x51, 0x80, 0x8F),
1397     "smalt": (0x00, 0x33, 0x99),
1398     "smoky": (0x60, 0x5B, 0x73),
1399     "snow drift": (0xF7, 0xFA, 0xF7),
1400     "snow flurry": (0xE4, 0xFF, 0xD1),
1401     "snow": (0xFF, 0xFA, 0xFA),
1402     "snowy mint": (0xD6, 0xFF, 0xDB),
1403     "snuff": (0xE2, 0xD8, 0xED),
1404     "soapstone": (0xFF, 0xFB, 0xF9),
1405     "soft amber": (0xD1, 0xC6, 0xB4),
1406     "soft peach": (0xF5, 0xED, 0xEF),
1407     "solid pink": (0x89, 0x38, 0x43),
1408     "solitaire": (0xFE, 0xF8, 0xE2),
1409     "solitude": (0xEA, 0xF6, 0xFF),
1410     "sorbus": (0xFD, 0x7C, 0x07),
1411     "sorrell brown": (0xCE, 0xB9, 0x8F),
1412     "soya bean": (0x6A, 0x60, 0x51),
1413     "spanish green": (0x81, 0x98, 0x85),
1414     "spectra": (0x2F, 0x5A, 0x57),
1415     "spice": (0x6A, 0x44, 0x2E),
1416     "spicy mix": (0x88, 0x53, 0x42),
1417     "spicy mustard": (0x74, 0x64, 0x0D),
1418     "spicy pink": (0x81, 0x6E, 0x71),
1419     "spindle": (0xB6, 0xD1, 0xEA),
1420     "spray": (0x79, 0xDE, 0xEC),
1421     "spring green": (0x00, 0xFF, 0x7F),
1422     "spring leaves": (0x57, 0x83, 0x63),
1423     "spring rain": (0xAC, 0xCB, 0xB1),
1424     "spring sun": (0xF6, 0xFF, 0xDC),
1425     "spring wood": (0xF8, 0xF6, 0xF1),
1426     "sprout": (0xC1, 0xD7, 0xB0),
1427     "spun pearl": (0xAA, 0xAB, 0xB7),
1428     "squirrel": (0x8F, 0x81, 0x76),
1429     "st tropaz": (0x2D, 0x56, 0x9B),
1430     "stack": (0x8A, 0x8F, 0x8A),
1431     "star dust": (0x9F, 0x9F, 0x9C),
1432     "stark white": (0xE5, 0xD7, 0xBD),
1433     "starship": (0xEC, 0xF2, 0x45),
1434     "steel blue": (0x46, 0x82, 0xB4),
1435     "steel gray": (0x26, 0x23, 0x35),
1436     "stiletto": (0x9C, 0x33, 0x36),
1437     "stonewall": (0x92, 0x85, 0x73),
1438     "storm dust": (0x64, 0x64, 0x63),
1439     "storm gray": (0x71, 0x74, 0x86),
1440     "stratos": (0x00, 0x07, 0x41),
1441     "straw": (0xD4, 0xBF, 0x8D),
1442     "strikemaster": (0x95, 0x63, 0x87),
1443     "stromboli": (0x32, 0x5D, 0x52),
1444     "studio": (0x71, 0x4A, 0xB2),
1445     "submarine": (0xBA, 0xC7, 0xC9),
1446     "sugar cane": (0xF9, 0xFF, 0xF6),
1447     "sulu": (0xC1, 0xF0, 0x7C),
1448     "summer green": (0x96, 0xBB, 0xAB),
1449     "sun": (0xFB, 0xAC, 0x13),
1450     "sundance": (0xC9, 0xB3, 0x5B),
1451     "sundown": (0xFF, 0xB1, 0xB3),
1452     "sunflower": (0xE4, 0xD4, 0x22),
1453     "sunglo": (0xE1, 0x68, 0x65),
1454     "sunglow": (0xFF, 0xCC, 0x33),
1455     "sunset orange": (0xFE, 0x4C, 0x40),
1456     "sunshade": (0xFF, 0x9E, 0x2C),
1457     "supernova": (0xFF, 0xC9, 0x01),
1458     "surf crest": (0xCF, 0xE5, 0xD2),
1459     "surf": (0xBB, 0xD7, 0xC1),
1460     "surfie green": (0x0C, 0x7A, 0x79),
1461     "sushi": (0x87, 0xAB, 0x39),
1462     "suva gray": (0x88, 0x83, 0x87),
1463     "swamp green": (0xAC, 0xB7, 0x8E),
1464     "swamp": (0x00, 0x1B, 0x1C),
1465     "swans down": (0xDC, 0xF0, 0xEA),
1466     "sweet corn": (0xFB, 0xEA, 0x8C),
1467     "sweet pink": (0xFD, 0x9F, 0xA2),
1468     "swirl": (0xD3, 0xCD, 0xC5),
1469     "swiss coffee": (0xDD, 0xD6, 0xD5),
1470     "sycamore": (0x90, 0x8D, 0x39),
1471     "tabasco": (0xA0, 0x27, 0x12),
1472     "tacao": (0xED, 0xB3, 0x81),
1473     "tacha": (0xD6, 0xC5, 0x62),
1474     "tahiti gold": (0xE9, 0x7C, 0x07),
1475     "tahuna sands": (0xEE, 0xF0, 0xC8),
1476     "tall poppy": (0xB3, 0x2D, 0x29),
1477     "tallow": (0xA8, 0xA5, 0x89),
1478     "tamarillo": (0x99, 0x16, 0x13),
1479     "tamarind": (0x34, 0x15, 0x15),
1480     "tan hide": (0xFA, 0x9D, 0x5A),
1481     "tan": (0xD2, 0xB4, 0x8C),
1482     "tana": (0xD9, 0xDC, 0xC1),
1483     "tangaroa": (0x03, 0x16, 0x3C),
1484     "tangerine": (0xF2, 0x85, 0x00),
1485     "tango": (0xED, 0x7A, 0x1C),
1486     "tapa": (0x7B, 0x78, 0x74),
1487     "tapestry": (0xB0, 0x5E, 0x81),
1488     "tara": (0xE1, 0xF6, 0xE8),
1489     "tarawera": (0x07, 0x3A, 0x50),
1490     "tasman": (0xCF, 0xDC, 0xCF),
1491     "taupe gray": (0xB3, 0xAF, 0x95),
1492     "taupe": (0x48, 0x3C, 0x32),
1493     "tawny port": (0x69, 0x25, 0x45),
1494     "te papa green": (0x1E, 0x43, 0x3C),
1495     "tea green": (0xD0, 0xF0, 0xC0),
1496     "tea": (0xC1, 0xBA, 0xB0),
1497     "teak": (0xB1, 0x94, 0x61),
1498     "teal blue": (0x04, 0x42, 0x59),
1499     "teal": (0x00, 0x80, 0x80),
1500     "temptress": (0x3B, 0x00, 0x0B),
1501     "tenn": (0xCD, 0x57, 0x00),
1502     "tequila": (0xFF, 0xE6, 0xC7),
1503     "terracotta": (0xE2, 0x72, 0x5B),
1504     "texas rose": (0xFF, 0xB5, 0x55),
1505     "texas": (0xF8, 0xF9, 0x9C),
1506     "thatch green": (0x40, 0x3D, 0x19),
1507     "thatch": (0xB6, 0x9D, 0x98),
1508     "thistle green": (0xCC, 0xCA, 0xA8),
1509     "thistle": (0xD8, 0xBF, 0xD8),
1510     "thunder": (0x33, 0x29, 0x2F),
1511     "thunderbird": (0xC0, 0x2B, 0x18),
1512     "tia maria": (0xC1, 0x44, 0x0E),
1513     "tiara": (0xC3, 0xD1, 0xD1),
1514     "tiber": (0x06, 0x35, 0x37),
1515     "tickle me pink": (0xFC, 0x80, 0xA5),
1516     "tidal": (0xF1, 0xFF, 0xAD),
1517     "tide": (0xBF, 0xB8, 0xB0),
1518     "timber green": (0x16, 0x32, 0x2C),
1519     "timberwolf": (0xD9, 0xD6, 0xCF),
1520     "titan white": (0xF0, 0xEE, 0xFF),
1521     "toast": (0x9A, 0x6E, 0x61),
1522     "tobacco brown": (0x71, 0x5D, 0x47),
1523     "toledo": (0x3A, 0x00, 0x20),
1524     "tolopea": (0x1B, 0x02, 0x45),
1525     "tom thumb": (0x3F, 0x58, 0x3B),
1526     "tomato": (0xFF, 0x63, 0x47),
1527     "tonys pink": (0xE7, 0x9F, 0x8C),
1528     "topaz": (0x7C, 0x77, 0x8A),
1529     "torch red": (0xFD, 0x0E, 0x35),
1530     "torea bay": (0x0F, 0x2D, 0x9E),
1531     "tory blue": (0x14, 0x50, 0xAA),
1532     "tosca": (0x8D, 0x3F, 0x3F),
1533     "totem pole": (0x99, 0x1B, 0x07),
1534     "tower gray": (0xA9, 0xBD, 0xBF),
1535     "tradewind": (0x5F, 0xB3, 0xAC),
1536     "tranquil": (0xE6, 0xFF, 0xFF),
1537     "travertine": (0xFF, 0xFD, 0xE8),
1538     "tree poppy": (0xFC, 0x9C, 0x1D),
1539     "treehouse": (0x3B, 0x28, 0x20),
1540     "trendy green": (0x7C, 0x88, 0x1A),
1541     "trendy pink": (0x8C, 0x64, 0x95),
1542     "trinidad": (0xE6, 0x4E, 0x03),
1543     "tropical blue": (0xC3, 0xDD, 0xF9),
1544     "tropical rain forest": (0x00, 0x75, 0x5E),
1545     "trout": (0x4A, 0x4E, 0x5A),
1546     "true v": (0x8A, 0x73, 0xD6),
1547     "tuatara": (0x36, 0x35, 0x34),
1548     "tuft bush": (0xFF, 0xDD, 0xCD),
1549     "tulip tree": (0xEA, 0xB3, 0x3B),
1550     "tumbleweed": (0xDE, 0xA6, 0x81),
1551     "tuna": (0x35, 0x35, 0x42),
1552     "tundora": (0x4A, 0x42, 0x44),
1553     "turbo": (0xFA, 0xE6, 0x00),
1554     "turkish rose": (0xB5, 0x72, 0x81),
1555     "turmeric": (0xCA, 0xBB, 0x48),
1556     "turquoise blue": (0x6C, 0xDA, 0xE7),
1557     "turquoise": (0x30, 0xD5, 0xC8),
1558     "turtle green": (0x2A, 0x38, 0x0B),
1559     "tuscany": (0xBD, 0x5E, 0x2E),
1560     "tusk": (0xEE, 0xF3, 0xC3),
1561     "tussock": (0xC5, 0x99, 0x4B),
1562     "tutu": (0xFF, 0xF1, 0xF9),
1563     "twilight blue": (0xEE, 0xFD, 0xFF),
1564     "twilight": (0xE4, 0xCF, 0xDE),
1565     "twine": (0xC2, 0x95, 0x5D),
1566     "tyrian purple": (0x66, 0x02, 0x3C),
1567     "ultramarine": (0x12, 0x0A, 0x8F),
1568     "valencia": (0xD8, 0x44, 0x37),
1569     "valentino": (0x35, 0x0E, 0x42),
1570     "valhalla": (0x2B, 0x19, 0x4F),
1571     "van cleef": (0x49, 0x17, 0x0C),
1572     "vanilla ice": (0xF3, 0xD9, 0xDF),
1573     "vanilla": (0xD1, 0xBE, 0xA8),
1574     "varden": (0xFF, 0xF6, 0xDF),
1575     "venetian red": (0x72, 0x01, 0x0F),
1576     "venice blue": (0x05, 0x59, 0x89),
1577     "venus": (0x92, 0x85, 0x90),
1578     "verdigris": (0x5D, 0x5E, 0x37),
1579     "verdun green": (0x49, 0x54, 0x00),
1580     "vermilion": (0xFF, 0x4D, 0x00),
1581     "vesuvius": (0xB1, 0x4A, 0x0B),
1582     "victoria": (0x53, 0x44, 0x91),
1583     "vida loca": (0x54, 0x90, 0x19),
1584     "viking": (0x64, 0xCC, 0xDB),
1585     "vin rouge": (0x98, 0x3D, 0x61),
1586     "viola": (0xCB, 0x8F, 0xA9),
1587     "violent violet": (0x29, 0x0C, 0x5E),
1588     "violet eggplant": (0x99, 0x11, 0x99),
1589     "violet red": (0xF7, 0x46, 0x8A),
1590     "violet": (0x24, 0x0A, 0x40),
1591     "viridian green": (0x67, 0x89, 0x75),
1592     "viridian": (0x40, 0x82, 0x6D),
1593     "vis vis": (0xFF, 0xEF, 0xA1),
1594     "vista blue": (0x8F, 0xD6, 0xB4),
1595     "vista white": (0xFC, 0xF8, 0xF7),
1596     "vivid tangerine": (0xFF, 0x99, 0x80),
1597     "vivid violet": (0x80, 0x37, 0x90),
1598     "voodoo": (0x53, 0x34, 0x55),
1599     "vulcan": (0x10, 0x12, 0x1D),
1600     "wafer": (0xDE, 0xCB, 0xC6),
1601     "waikawa gray": (0x5A, 0x6E, 0x9C),
1602     "waiouru": (0x36, 0x3C, 0x0D),
1603     "walnut": (0x77, 0x3F, 0x1A),
1604     "wannabe.house": (0x00, 0x00, 95),
1605     "wasabi": (0x78, 0x8A, 0x25),
1606     "water leaf": (0xA1, 0xE9, 0xDE),
1607     "watercourse": (0x05, 0x6F, 0x57),
1608     "waterloo ": (0x7B, 0x7C, 0x94),
1609     "wattle": (0xDC, 0xD7, 0x47),
1610     "watusi": (0xFF, 0xDD, 0xCF),
1611     "wax flower": (0xFF, 0xC0, 0xA8),
1612     "we peep": (0xF7, 0xDB, 0xE6),
1613     "web orange": (0xFF, 0xA5, 0x00),
1614     "wedgewood": (0x4E, 0x7F, 0x9E),
1615     "well read": (0xB4, 0x33, 0x32),
1616     "west coast": (0x62, 0x51, 0x19),
1617     "west side": (0xFF, 0x91, 0x0F),
1618     "westar": (0xDC, 0xD9, 0xD2),
1619     "wewak": (0xF1, 0x9B, 0xAB),
1620     "wheat": (0xF5, 0xDE, 0xB3),
1621     "wheatfield": (0xF3, 0xED, 0xCF),
1622     "whiskey": (0xD5, 0x9A, 0x6F),
1623     "whisper": (0xF7, 0xF5, 0xFA),
1624     "white ice": (0xDD, 0xF9, 0xF1),
1625     "white lilac": (0xF8, 0xF7, 0xFC),
1626     "white linen": (0xF8, 0xF0, 0xE8),
1627     "white pointer": (0xFE, 0xF8, 0xFF),
1628     "white rock": (0xEA, 0xE8, 0xD4),
1629     "white smoke": (0xF5, 0xF5, 0xF5),
1630     "white": (0xFF, 0xFF, 0xFF),
1631     "wild blue yonder": (0x7A, 0x89, 0xB8),
1632     "wild rice": (0xEC, 0xE0, 0x90),
1633     "wild sand": (0xF4, 0xF4, 0xF4),
1634     "wild strawberry": (0xFF, 0x33, 0x99),
1635     "wild watermelon": (0xFD, 0x5B, 0x78),
1636     "wild willow": (0xB9, 0xC4, 0x6A),
1637     "william": (0x3A, 0x68, 0x6C),
1638     "willow brook": (0xDF, 0xEC, 0xDA),
1639     "willow grove": (0x65, 0x74, 0x5D),
1640     "windsor": (0x3C, 0x08, 0x78),
1641     "wine berry": (0x59, 0x1D, 0x35),
1642     "winter hazel": (0xD5, 0xD1, 0x95),
1643     "wisp pink": (0xFE, 0xF4, 0xF8),
1644     "wisteria": (0x97, 0x71, 0xB5),
1645     "wistful": (0xA4, 0xA6, 0xD3),
1646     "witch haze": (0xFF, 0xFC, 0x99),
1647     "wood bark": (0x26, 0x11, 0x05),
1648     "woodland": (0x4D, 0x53, 0x28),
1649     "woodrush": (0x30, 0x2A, 0x0F),
1650     "woodsmoke": (0x0C, 0x0D, 0x0F),
1651     "woody brown": (0x48, 0x31, 0x31),
1652     "xanadu": (0x73, 0x86, 0x78),
1653     "yellow green": (0xC5, 0xE1, 0x7A),
1654     "yellow metal": (0x71, 0x63, 0x38),
1655     "yellow orange": (0xFF, 0xAE, 0x42),
1656     "yellow sea": (0xFE, 0xA9, 0x04),
1657     "yellow": (0xFF, 0xFF, 0x00),
1658     "your pink": (0xFF, 0xC3, 0xC0),
1659     "yukon gold": (0x7B, 0x66, 0x08),
1660     "yuma": (0xCE, 0xC2, 0x91),
1661     "zambezi": (0x68, 0x55, 0x58),
1662     "zanah": (0xDA, 0xEC, 0xD6),
1663     "zest": (0xE5, 0x84, 0x1B),
1664     "zeus": (0x29, 0x23, 0x19),
1665     "ziggurat": (0xBF, 0xDB, 0xE2),
1666     "zinnwaldite": (0xEB, 0xC2, 0xAF),
1667     "zircon": (0xF4, 0xF8, 0xFF),
1668     "zombie": (0xE4, 0xD6, 0x9B),
1669     "zorba": (0xA5, 0x9B, 0x91),
1670     "zuccini": (0x04, 0x40, 0x22),
1671     "zumthor": (0xED, 0xF6, 0xFF),
1672 }
1673
1674
1675 def clear() -> str:
1676     """Returns:
1677     An ANSI escape sequence that clears the screen.
1678     """
1679     return "\x1B[H\x1B[2J"
1680
1681
1682 def clear_screen() -> str:
1683     """Returns:
1684     An ANSI escape sequence that clears the screen.
1685     """
1686     return clear()
1687
1688
1689 def clear_line() -> str:
1690     """Returns:
1691     An ANSI escape sequence that clears the current line from the cursor
1692     position to the end of the line.
1693     """
1694     return "\x1B[2K\r"
1695
1696
1697 def reset() -> str:
1698     """Returns:
1699         An ANSI escape sequence that resets text attributes to 'normal'.  This
1700         sequence ends any different foreground or background color settings.
1701         It also ends any special text styling (italics, bold, underline, etc...)
1702         that have been previously set.
1703
1704     See also :py:meth:`reset_bg` and :py:meth:`reset_fg`.
1705     """
1706     return "\x1B[m"
1707
1708
1709 def normal() -> str:
1710     """Returns:
1711         An ANSI escape sequence that resets text attributes to 'normal'.  This
1712         sequence ends any different foreground or background color settings.
1713         It also ends any special text styling (italics, bold, underline, etc...)
1714         that have been previously set.
1715
1716     See also :py:meth:`reset_bg` and :py:meth:`reset_fg`.
1717     """
1718     return reset()
1719
1720
1721 def bold() -> str:
1722     """Returns:
1723     The ANSI escape sequence to set text to bold weight.
1724     """
1725     return "\x1B[1m"
1726
1727
1728 def italic() -> str:
1729     """Returns:
1730     The ANSI escape sequence to set text to italics style.
1731     """
1732     return "\x1B[3m"
1733
1734
1735 def italics() -> str:
1736     """Returns:
1737     The ANSI escape sequence to set text to italics style.
1738     """
1739     return italic()
1740
1741
1742 def underline() -> str:
1743     """Returns:
1744     The ANSI escape sequence to set text to underlined style.
1745     """
1746     return "\x1B[4m"
1747
1748
1749 def strikethrough() -> str:
1750     """Returns:
1751     The ANSI escape sequence to set text to strike-through mode.
1752     """
1753     return "\x1B[9m"
1754
1755
1756 def strike_through() -> str:
1757     """Returns:
1758     The ANSI escape sequence to set text to strike-through mode.
1759     """
1760     return strikethrough()
1761
1762
1763 def _is_16color(num: int) -> bool:
1764     """One ANSI escape sequences (^[[#m) can be used to change text
1765     foreground and background color if and only if the R, G and B
1766     numbers are 128 or 255.  This means this code can be used to
1767     create 16 colors.
1768     """
1769     return num in (255, 128)
1770
1771
1772 def _is_216color(num: int) -> bool:
1773     """Another ANSI escape sequence (^[[38;5;#m) can be used to change
1774     text color to 216 separate color values with each of R, G and B
1775     one of 6 possible values."""
1776     return num in set([0, 95, 135, 175, 223, 255])
1777
1778
1779 def _simple_color_number(red: int, green: int, blue: int) -> int:
1780     """Construct a simple color number.  This is a 3 bit number
1781     used to construct a 16-color escape code."""
1782     r = red > 0
1783     g = green > 0
1784     b = blue > 0
1785     return b << 2 | g << 1 | r
1786
1787
1788 def fg_16color(red: int, green: int, blue: int) -> str:
1789     """
1790     Set text foreground color to a color in 16-color space.
1791
1792     Args:
1793         red: the red channel value of the foreground color to set
1794         green: the green channel value of the foreground color to set
1795         blue: the blue channel value of the foreground color to set
1796
1797     Returns:
1798         An ANSI escape code that sets the foreground color described
1799         by the red, green and blue from the 16 color space.
1800
1801     .. note::
1802
1803         In 16 color mode, the possible color values are limited to
1804         red, green, yellow, blue, purple, cyan, white and black
1805         each with or without a "bright" attribute.  This function
1806         takes R/G/B parameter values that can be used to describe
1807         colors that can't be represented in 16-color space.  If
1808         such a color is described by the parameters, it maps the
1809         color to its closest representation in 16-color space.
1810
1811     This is used by :py:meth:`fg` internally but can be called
1812     directly too.  See also :py:meth:`fg_216color`,
1813     :py:meth:`fg_24bit`, and :py:meth:`bg_16color`.
1814     """
1815
1816     code = _simple_color_number(red, green, blue) + 30
1817     bright_count = 0
1818     if red > 128:
1819         bright_count += 1
1820     if green > 128:
1821         bright_count += 1
1822     if blue > 128:
1823         bright_count += 1
1824     if bright_count > 1:
1825         code += 60
1826     return f"\x1B[{code}m"
1827
1828
1829 def bg_16color(red: int, green: int, blue: int) -> str:
1830     """
1831     Set text background color to a color in 16-color space.
1832
1833     Args:
1834         red: the red channel value of background color to set
1835         green: the green channel value of the background color to set
1836         blue: the blue channel value of the background color to set
1837
1838     Returns:
1839         An ANSI escape sequence that sets the background color to the
1840         color described by the red, green and blue parameters in the
1841         16 color space.
1842
1843     .. note::
1844
1845         In 16 color mode, the possible color values are limited to
1846         red, green, yellow, blue, purple, cyan, white and black
1847         each with or without a "bright" attribute.  This function
1848         takes R/G/B parameter values that can be used to describe
1849         colors that can't be represented in 16-color space.  If
1850         such a color is described by the parameters, it maps the
1851         color to its closest representation in 16-color space.
1852
1853     This is used by :py:meth:`bg` internally but can be invoked
1854     directly if needed.  See also :py:meth:`fg_16color`,
1855     :py:meth:`bg_216color`, and :py:meth:`bg_24bit`.
1856     """
1857
1858     code = _simple_color_number(red, green, blue) + 40
1859     bright_count = 0
1860     if red > 128:
1861         bright_count += 1
1862     if green > 128:
1863         bright_count += 1
1864     if blue > 128:
1865         bright_count += 1
1866     if bright_count > 1:
1867         code += 60
1868     return f"\x1B[{code}m"
1869
1870
1871 def _pixel_to_216color(n: int) -> int:
1872     """Help convert full RGB color descriptions into valid 216 color space"""
1873     if n >= 255:
1874         return 5
1875     if n >= 233:
1876         return 4
1877     if n >= 175:
1878         return 3
1879     if n >= 135:
1880         return 2
1881     if n >= 95:
1882         return 1
1883     return 0
1884
1885
1886 def fg_216color(red: int, green: int, blue: int) -> str:
1887     """
1888     Set text foreground color to a color in 216 color space.
1889
1890     Args:
1891         red: the red channel value of the foreground color to set
1892         green: the green channel value of the foreground color to set
1893         blue: the blue channel value of the foreground color to set
1894
1895     Returns:
1896         An ANSI escape code that sets the foreground color described
1897         by the red, green and blue from the 216 color space.
1898
1899     .. note::
1900
1901         In 216 color mode there are 216 total colors available.
1902         This is less than the 16M (256^3) possibilities that can
1903         be described by full RGB tuples.  When passed colors that
1904         are not available in 216 color mode, this code finds the
1905         closest match in 216 color space and returns that.
1906
1907     This is used by :py:meth:`fg` internally but can be invoked
1908     directly if needed.  See also :py:meth:`fg_16color`,
1909     :py:meth`fg_24bit`, and :py:meth:`bg_216color`.
1910     """
1911     r = _pixel_to_216color(red)
1912     g = _pixel_to_216color(green)
1913     b = _pixel_to_216color(blue)
1914     code = 16 + r * 36 + g * 6 + b
1915     return f"\x1B[38;5;{code}m"
1916
1917
1918 def bg_216color(red: int, green: int, blue: int) -> str:
1919     """
1920     Set text background color to a color in 216 color space.
1921
1922     Args:
1923         red: the red channel value of the background color to set
1924         green: the green channel value of the background color to set
1925         blue: the blue channel value of the foreground color to set
1926
1927     Returns:
1928         An ANSI escape code that sets the background color described
1929         by the red, green and blue from the 216 color space.
1930
1931     .. note::
1932
1933         In 216 color mode there are 216 total colors available.
1934         This is less than the 16M (256^3) possibilities that can
1935         be described by full RGB tuples.  When passed colors that
1936         are not available in 216 color mode, this code finds the
1937         closest match in 216 color space and returns that.
1938
1939     This is used by :py:meth:`bg` internally but can be invoked
1940     directly if needed.  See also :py:meth:`bg_16color`,
1941     :py:meth:`bg_24bit`, and :py:meth:`fg_216color`.
1942     """
1943     r = _pixel_to_216color(red)
1944     g = _pixel_to_216color(green)
1945     b = _pixel_to_216color(blue)
1946     code = 16 + r * 36 + g * 6 + b
1947     return f"\x1B[48;5;{code}m"
1948
1949
1950 def _pixel_to_24bit_color(value: int) -> int:
1951     """Helper to ensure a color channel value is valid in 24-bit color space."""
1952     if value < 0:
1953         return 0
1954     if value > 255:
1955         return 255
1956     return value
1957
1958
1959 def fg_24bit(red: int, green: int, blue: int) -> str:
1960     """
1961     Set text foreground color to a color in 24-bit color space.
1962
1963     Args:
1964         red: the red channel value of the foreground color to set
1965         green: the green channel value of the foreground color to set
1966         blue: the blue channel value of the foreground color to set
1967
1968     Returns:
1969         An ANSI escape code that sets the foreground color described
1970         by the red, green and blue from 24-bit color space.
1971
1972     .. note::
1973
1974         In 24-bit color space we can represent any color described
1975         by red, green or blue values where 0 <= value <= 255.
1976         Values outside of this range will be mapped into the 24-bit
1977         color space.
1978
1979     This is used by :py:meth:`fg` internally but can be invoked directly
1980     if useful.  See also :py:meth:`fg_216color` and :py:meth:`bg_24bit`.
1981     """
1982     return f"\x1B[38;2;{_pixel_to_24bit_color(red)};{_pixel_to_24bit_color(green)};{_pixel_to_24bit_color(blue)}m"
1983
1984
1985 def bg_24bit(red: int, green: int, blue: int) -> str:
1986     """
1987     Set text background color to a color in 24-bit color space.
1988
1989     Args:
1990         red: the red channel value of the background color to set
1991         green: the green channel value of the backgrounf color to set
1992         blue: the blue channel value of the background color to set
1993
1994     Returns:
1995         An ANSI escape code that sets the background color described
1996         by the red, green and blue from 24-bit color space.
1997
1998     .. note::
1999
2000         In 24-bit color space we can represent any color described
2001         by red, green or blue values where 0 <= value <= 255.
2002         Values outside of this range will be mapped into the 24-bit
2003         color space.
2004
2005     This is used by :py:meth:`fg` internally but can be invoked directly
2006     if useful.  See also :py:meth:`fg_216color` and :py:meth:`bg_24bit`.
2007     """
2008     return f"\x1B[48;2;{_pixel_to_24bit_color(red)};{_pixel_to_24bit_color(green)};{_pixel_to_24bit_color(blue)}m"
2009
2010
2011 def _find_color_by_name(name: str) -> Tuple[int, int, int]:
2012     """Given a color name, look up its RGB channel values from the COLOR_NAMES_TO_RGB
2013     table."""
2014     rgb = COLOR_NAMES_TO_RGB.get(name.lower(), None)
2015     if rgb is None:
2016         name = _guess_name(name)
2017         rgb = COLOR_NAMES_TO_RGB.get(name.lower(), None)
2018         assert rgb is not None
2019     return rgb
2020
2021
2022 @logging_utils.squelch_repeated_log_messages(1)
2023 def fg(
2024     name: Optional[str] = "",
2025     red: Optional[int] = None,
2026     green: Optional[int] = None,
2027     blue: Optional[int] = None,
2028     *,
2029     force_16color: bool = False,
2030     force_216color: bool = False,
2031 ) -> str:
2032     """Return the ANSI escape sequence to change the foreground color
2033     text is printed to the console with.  Target colors may be
2034     indicated either by name or R/G/B values.  Result will use the 16
2035     or 216 color scheme if force_16color or force_216color are passed
2036     (respectively).  Otherwise the code will do what it thinks best.
2037
2038     Args:
2039         name: the name of the color to set
2040         red: the color to set's red component value
2041         green: the color to set's green component value
2042         blue: the color to set's blue component value
2043         force_16color: force fg to use 16 color mode
2044         force_216color: force fg to use 216 color mode
2045
2046     Returns:
2047         String containing the ANSI escape sequence to set desired foreground
2048
2049     .. note::
2050
2051         16-color and 216-color spaces can't be used to represent all colors
2052         describable by 8 bit R, G and B channels (i.e. normal R/G/B hex values)
2053         If you set the force_16color or force_216color arguments but describe
2054         a color (by name or R/G/B) that can't be represented in the forced
2055         color space the code will pick the closest approximation available.
2056
2057     >>> import string_utils as su
2058     >>> su.to_base64(fg('blue'))
2059     b'G1szODs1OzIxbQ==\\n'
2060     """
2061     if name is not None and name == 'reset':
2062         return reset_fg()
2063
2064     if name is not None and string_utils.is_full_string(name):
2065         rgb = _find_color_by_name(name)
2066         return fg(
2067             None,
2068             rgb[0],
2069             rgb[1],
2070             rgb[2],
2071             force_16color=force_16color,
2072             force_216color=force_216color,
2073         )
2074
2075     if red is None:
2076         red = 0
2077     if green is None:
2078         green = 0
2079     if blue is None:
2080         blue = 0
2081     if (_is_16color(red) and _is_16color(green) and _is_16color(blue)) or force_16color:
2082         logger.debug("Using 16-color strategy")
2083         return fg_16color(red, green, blue)
2084     if (
2085         _is_216color(red) and _is_216color(green) and _is_216color(blue)
2086     ) or force_216color:
2087         logger.debug("Using 216-color strategy")
2088         return fg_216color(red, green, blue)
2089     logger.debug("Using 24-bit color strategy")
2090     return fg_24bit(red, green, blue)
2091
2092
2093 def reset_fg():
2094     """Returns: an ANSI escape code to reset just the foreground color
2095     while preserving the background color and any other formatting
2096     (bold, italics, etc...)
2097     """
2098     return '\033[39m'
2099
2100
2101 def _rgb_to_yiq(rgb: Tuple[int, int, int]) -> int:
2102     """Helper for contrasting pick_contrasting_color.  Maps an RGB
2103     color tuple in to YIQ space.  See: https://en.wikipedia.org/wiki/YIQ."""
2104     return (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) // 1000
2105
2106
2107 def _contrast(rgb: Tuple[int, int, int]) -> Tuple[int, int, int]:
2108     """Helper for contrasting pick_contrasting_color."""
2109     if _rgb_to_yiq(rgb) < 128:
2110         return (0xFF, 0xFF, 0xFF)
2111     return (0, 0, 0)
2112
2113
2114 def pick_contrasting_color(
2115     name: Optional[str] = "",
2116     red: Optional[int] = None,
2117     green: Optional[int] = None,
2118     blue: Optional[int] = None,
2119 ) -> Tuple[int, int, int]:
2120     """This method will return a red, green, blue tuple representing a
2121     contrasting color given the red, green, blue of a background
2122     color or a color name of the background color.  This is meant to
2123     help ensure text printed on this background color will be visible.
2124
2125     Args:
2126         name: the name of the color to contrast
2127         red: the color to contrast's red component value
2128         green: the color to contrast's green component value
2129         blue: the color to contrast's blue component value
2130
2131     Returns:
2132         An RGB tuple containing a contrasting color
2133
2134     >>> pick_contrasting_color(None, 20, 20, 20)
2135     (255, 255, 255)
2136
2137     >>> pick_contrasting_color("white")
2138     (0, 0, 0)
2139
2140     """
2141     if name is not None and string_utils.is_full_string(name):
2142         rgb = _find_color_by_name(name)
2143     else:
2144         r = red if red is not None else 0
2145         g = green if green is not None else 0
2146         b = blue if blue is not None else 0
2147         rgb = (r, g, b)
2148     assert rgb is not None
2149     return _contrast(rgb)
2150
2151
2152 def _guess_name(name: str) -> str:
2153     """Try to guess what color the user is talking about"""
2154     best_guess = None
2155     max_ratio = None
2156     for possibility in COLOR_NAMES_TO_RGB:
2157         r = difflib.SequenceMatcher(None, name, possibility).ratio()
2158         if max_ratio is None or r > max_ratio:
2159             max_ratio = r
2160             best_guess = possibility
2161     assert best_guess is not None
2162     logger.debug("Best guess at color name is %s", best_guess)
2163     return best_guess
2164
2165
2166 @logging_utils.squelch_repeated_log_messages(1)
2167 def bg(
2168     name: Optional[str] = "",
2169     red: Optional[int] = None,
2170     green: Optional[int] = None,
2171     blue: Optional[int] = None,
2172     *,
2173     force_16color: bool = False,
2174     force_216color: bool = False,
2175 ) -> str:
2176     """Returns an ANSI color code for changing the current text background
2177     color.
2178
2179     Args:
2180         name: the name of the color to set
2181         red: the color to set's red component value
2182         green: the color to set's green component value
2183         blue: the color to set's blue component value
2184         force_16color: force bg to use 16 color mode
2185         force_216color: force bg to use 216 color mode
2186
2187     Returns:
2188         A string containing the requested escape sequence
2189
2190     .. note::
2191
2192         16-color and 216-color spaces can't be used to represent all colors
2193         describable by 8 bit R, G and B channels (i.e. normal R/G/B hex values)
2194         If you set the force_16color or force_216color arguments but describe
2195         a color (by name or R/G/B) that can't be represented in the forced
2196         color space the code will pick the closest approximation available.
2197
2198     >>> import string_utils as su
2199     >>> su.to_base64(bg("red"))    # b'\x1b[48;5;196m'
2200     b'G1s0ODs1OzE5Nm0=\\n'
2201     """
2202     if name is not None and name == 'reset':
2203         return reset_bg()
2204
2205     if name is not None and string_utils.is_full_string(name):
2206         rgb = _find_color_by_name(name)
2207         return bg(
2208             None,
2209             rgb[0],
2210             rgb[1],
2211             rgb[2],
2212             force_16color=force_16color,
2213             force_216color=force_216color,
2214         )
2215     if red is None:
2216         red = 0
2217     if green is None:
2218         green = 0
2219     if blue is None:
2220         blue = 0
2221     if (_is_16color(red) and _is_16color(green) and _is_16color(blue)) or force_16color:
2222         logger.debug("Using 16-color strategy")
2223         return bg_16color(red, green, blue)
2224     if (
2225         _is_216color(red) and _is_216color(green) and _is_216color(blue)
2226     ) or force_216color:
2227         logger.debug("Using 216-color strategy")
2228         return bg_216color(red, green, blue)
2229     logger.debug("Using 24-bit color strategy")
2230     return bg_24bit(red, green, blue)
2231
2232
2233 def reset_bg():
2234     """Returns an ANSI escape sequence that resets text background
2235     color to the default but preserves foreground coloring and text
2236     attributes like bold, italics, underlines, etc...
2237     """
2238     return '\033[49m'
2239
2240
2241 class _StdoutInterceptor(io.TextIOBase, contextlib.AbstractContextManager):
2242     """An interceptor for data written to stdout.  Use as a context."""
2243
2244     def __init__(self):
2245         super().__init__()
2246         self.saved_stdout: io.TextIO = None
2247         self.buf = ''
2248
2249     @abstractmethod
2250     def write(self, s: str):
2251         pass
2252
2253     def __enter__(self):
2254         self.saved_stdout = sys.stdout
2255         sys.stdout = self
2256         return self
2257
2258     def __exit__(self, *args) -> None:
2259         sys.stdout = self.saved_stdout
2260         print(self.buf)
2261
2262
2263 class ProgrammableColorizer(_StdoutInterceptor):
2264     """A colorizing interceptor; pass it re.Patterns -> methods that
2265     do something (usually add color to) the match.  This may be useful
2266     for adding color to non-colorized text in a stream without
2267     changing the code that emits the text directly.  In the example
2268     doctest below I'm inserting [RED] and [RESET] strings but you
2269     could just as easily insert escape sequences returned from
2270     :py:meth:`fg`, :py:meth:`bg`, and :py:meth:`reset`.
2271
2272     >>> def red(match: re.Match, s: str) -> str:
2273     ...     return '[RED]'
2274
2275     >>> def reset(match: re.Match, s: str) -> str:
2276     ...     return '[RESET]'
2277
2278     >>> with ProgrammableColorizer( [ (re.compile('^[^ ]+'), red),
2279     ...                               (re.compile('$'), reset) ] ) as c:
2280     ...     c.write("This matches the pattern and will call red()")
2281     ...     c.write("     ...this won't")
2282     [RED] matches the pattern and will call red()[RESET]     ...this won't[RESET]
2283     """
2284
2285     def __init__(
2286         self,
2287         patterns: Iterable[Tuple[re.Pattern, Callable[[re.Match[str], str], str]]],
2288     ):
2289         """
2290         Setup the programmable colorizing context; tell it how to operate.
2291
2292         Args:
2293             patterns: an iterable collection of tuples.  Each tuple has an
2294                 re.Pattern that describes the text pattern which
2295                 will trigger the colorization and a method to call when the
2296                 pattern is matched.  These methods receive the `re.MATCH`
2297                 object and usually just emit some ANSI escape sequence to
2298                 colorize the stream.  See the example above.
2299         """
2300         super().__init__()
2301         self.patterns = list(patterns)
2302
2303     @overrides
2304     def write(self, s: str):
2305         """Use this method to feed the stream of text through the colorizer.
2306         See the example above.
2307
2308         Args:
2309             s: A line from the stream to colorize.
2310         """
2311         for pattern in self.patterns:
2312             s = pattern[0].sub(pattern[1], s)
2313         self.buf += s
2314
2315
2316 if __name__ == '__main__':
2317
2318     def main() -> None:
2319         import doctest
2320
2321         doctest.testmod()
2322
2323         name = " ".join(sys.argv[1:])
2324         for possibility in COLOR_NAMES_TO_RGB:
2325             if name in possibility:
2326                 f = fg(possibility)
2327                 b = bg(possibility)
2328                 _ = pick_contrasting_color(possibility)
2329                 xf = fg(None, _[0], _[1], _[2])
2330                 xb = bg(None, _[0], _[1], _[2])
2331                 print(
2332                     f'{f}{xb}{possibility}{reset()}\t\t\t'
2333                     f'{b}{xf}{possibility}{reset()}'
2334                 )
2335
2336     main()