Adds a __repr__ to graph.
[pyutils.git] / src / pyutils / ansi.py
1 #!/usr/bin/env python3
2
3 # © Copyright 2021-2023, 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     "kelly green": (0x4C, 0xBB, 0x17),
802     "kelp": (0x45, 0x49, 0x36),
803     "kenyan copper": (0x7C, 0x1C, 0x05),
804     "keppel": (0x3A, 0xB0, 0x9E),
805     "key lime pie": (0xBF, 0xC9, 0x21),
806     "khaki": (0xF0, 0xE6, 0x8C),
807     "kidnapper": (0xE1, 0xEA, 0xD4),
808     "kilamanjaro": (0x24, 0x0C, 0x02),
809     "killarney": (0x3A, 0x6A, 0x47),
810     "kimberly": (0x73, 0x6C, 0x9F),
811     "kingfisher daisy": (0x3E, 0x04, 0x80),
812     "kiosk.house": (90, 95, 0),
813     "klein blue": (0x00, 0x2F, 0xA7),
814     "kobi": (0xE7, 0x9F, 0xC4),
815     "kokoda": (0x6E, 0x6D, 0x57),
816     "korma": (0x8F, 0x4B, 0x0E),
817     "koromiko": (0xFF, 0xBD, 0x5F),
818     "kournikova": (0xFF, 0xE7, 0x72),
819     "kumera": (0x88, 0x62, 0x21),
820     "la palma": (0x36, 0x87, 0x16),
821     "la rioja": (0xB3, 0xC1, 0x10),
822     "las palmas": (0xC6, 0xE6, 0x10),
823     "laser lemon": (0xFF, 0xFF, 0x66),
824     "laser": (0xC8, 0xB5, 0x68),
825     "laurel": (0x74, 0x93, 0x78),
826     "lavender blush": (0xFF, 0xF0, 0xF5),
827     "lavender gray": (0xBD, 0xBB, 0xD7),
828     "lavender magenta": (0xEE, 0x82, 0xEE),
829     "lavender pink": (0xFB, 0xAE, 0xD2),
830     "lavender purple": (0x96, 0x7B, 0xB6),
831     "lavender rose": (0xFB, 0xA0, 0xE3),
832     "lavender": (0xB5, 0x7E, 0xDC),
833     "lawn green": (0x7C, 0xFC, 0x00),
834     "leather": (0x96, 0x70, 0x59),
835     "lemon chiffon": (0xFF, 0xFA, 0xCD),
836     "lemon ginger": (0xAC, 0x9E, 0x22),
837     "lemon grass": (0x9B, 0x9E, 0x8F),
838     "lemon": (0xFD, 0xE9, 0x10),
839     "light apricot": (0xFD, 0xD5, 0xB1),
840     "light blue": (0xAD, 0xD8, 0xE6),
841     "light coral": (0xF0, 0x80, 0x80),
842     "light cyan": (0xE0, 0xFF, 0xFF),
843     "light goldenrod": (0xFA, 0xFA, 0xD2),
844     "light gray": (0x26, 0x23, 0x35),
845     "light green": (0x90, 0xEE, 0x90),
846     "light orchid": (0xE2, 0x9C, 0xD2),
847     "light pink": (0xDD, 0xB6, 0xC1),
848     "light salmon": (0xDD, 0xA0, 0x7A),
849     "light sea green": (0x20, 0xB2, 0xAA),
850     "light slate gray": (0x77, 0x88, 0x99),
851     "light steel blue": (0xB0, 0xC4, 0xDE),
852     "light wisteria": (0xC9, 0xA0, 0xDC),
853     "light yellow": (0xFF, 0xFF, 0xE0),
854     "lightning yellow": (0xFC, 0xC0, 0x1E),
855     "lilac bush": (0x98, 0x74, 0xD3),
856     "lilac": (0xC8, 0xA2, 0xC8),
857     "lily white": (0xE7, 0xF8, 0xFF),
858     "lily": (0xC8, 0xAA, 0xBF),
859     "lima": (0x76, 0xBD, 0x17),
860     "lime": (0xBF, 0xFF, 0x00),
861     "limeade": (0x6F, 0x9D, 0x02),
862     "limed ash": (0x74, 0x7D, 0x63),
863     "limed oak": (0xAC, 0x8A, 0x56),
864     "limed spruce": (0x39, 0x48, 0x51),
865     "linen": (0xFA, 0xF0, 0xE6),
866     "link water": (0xD9, 0xE4, 0xF5),
867     "lipstick": (0xAB, 0x05, 0x63),
868     "lisbon brown": (0x42, 0x39, 0x21),
869     "livid brown": (0x4D, 0x28, 0x2E),
870     "loafer": (0xEE, 0xF4, 0xDE),
871     "loblolly": (0xBD, 0xC9, 0xCE),
872     "lochinvar": (0x2C, 0x8C, 0x84),
873     "lochmara": (0x00, 0x7E, 0xC7),
874     "locust": (0xA8, 0xAF, 0x8E),
875     "log cabin": (0x24, 0x2A, 0x1D),
876     "logan": (0xAA, 0xA9, 0xCD),
877     "lola": (0xDF, 0xCF, 0xDB),
878     "london hue": (0xBE, 0xA6, 0xC3),
879     "lonestar": (0x6D, 0x01, 0x01),
880     "lotus": (0x86, 0x3C, 0x3C),
881     "loulou": (0x46, 0x0B, 0x41),
882     "lucky point": (0x1A, 0x1A, 0x68),
883     "lucky": (0xAF, 0x9F, 0x1C),
884     "lunar green": (0x3C, 0x49, 0x3A),
885     "luxor gold": (0xA7, 0x88, 0x2C),
886     "lynch": (0x69, 0x7E, 0x9A),
887     "mabel": (0xD9, 0xF7, 0xFF),
888     "macaroni and cheese": (0xFF, 0xB9, 0x7B),
889     "madang": (0xB7, 0xF0, 0xBE),
890     "madison": (0x09, 0x25, 0x5D),
891     "madras": (0x3F, 0x30, 0x02),
892     "magenta": (0xFF, 0x00, 0xFF),
893     "magic mint": (0xAA, 0xF0, 0xD1),
894     "magnolia": (0xF8, 0xF4, 0xFF),
895     "mahogany": (0x4E, 0x06, 0x06),
896     "mai tai": (0xB0, 0x66, 0x08),
897     "maize": (0xF5, 0xD5, 0xA0),
898     "makara": (0x89, 0x7D, 0x6D),
899     "mako": (0x44, 0x49, 0x54),
900     "malachite": (0x0B, 0xDA, 0x51),
901     "malibu": (0x7D, 0xC8, 0xF7),
902     "mallard": (0x23, 0x34, 0x18),
903     "malta": (0xBD, 0xB2, 0xA1),
904     "mamba": (0x8E, 0x81, 0x90),
905     "manatee": (0x8D, 0x90, 0xA1),
906     "mandalay": (0xAD, 0x78, 0x1B),
907     "mandy": (0xE2, 0x54, 0x65),
908     "mandys pink": (0xF2, 0xC3, 0xB2),
909     "mango tango": (0xE7, 0x72, 0x00),
910     "manhattan": (0xF5, 0xC9, 0x99),
911     "mantis": (0x74, 0xC3, 0x65),
912     "mantle": (0x8B, 0x9C, 0x90),
913     "manz": (0xEE, 0xEF, 0x78),
914     "mardi gras": (0x35, 0x00, 0x36),
915     "marigold yellow": (0xFB, 0xE8, 0x70),
916     "marigold": (0xB9, 0x8D, 0x28),
917     "mariner": (0x28, 0x6A, 0xCD),
918     "maroon flush": (0xC3, 0x21, 0x48),
919     "maroon oak": (0x52, 0x0C, 0x17),
920     "maroon": (0x80, 0x00, 0x00),
921     "marshland": (0x0B, 0x0F, 0x08),
922     "martini": (0xAF, 0xA0, 0x9E),
923     "martinique": (0x36, 0x30, 0x50),
924     "marzipan": (0xF8, 0xDB, 0x9D),
925     "masala": (0x40, 0x3B, 0x38),
926     "matisse": (0x1B, 0x65, 0x9D),
927     "matrix": (0xB0, 0x5D, 0x54),
928     "matterhorn": (0x4E, 0x3B, 0x41),
929     "mauve": (0xE0, 0xB0, 0xFF),
930     "mauvelous": (0xF0, 0x91, 0xA9),
931     "maverick": (0xD8, 0xC2, 0xD5),
932     "medium aquamarine": (0x66, 0xCD, 0xAA),
933     "medium blue": (0x00, 0x00, 0xCD),
934     "medium carmine": (0xAF, 0x40, 0x35),
935     "medium orchid": (0xBA, 0x55, 0xD3),
936     "medium purple": (0x93, 0x70, 0xDB),
937     "medium red violet": (0xBB, 0x33, 0x85),
938     "medium sea green": (0x3C, 0xB3, 0x71),
939     "medium slate blue": (0x7B, 0x68, 0xEE),
940     "medium spring green": (0x00, 0xFA, 0x9A),
941     "medium turquoise": (0x48, 0xD1, 0xCC),
942     "medium violet red": (0xC7, 0x15, 0x85),
943     "meerkat.cabin": (95, 0x00, 95),
944     "melanie": (0xE4, 0xC2, 0xD5),
945     "melanzane": (0x30, 0x05, 0x29),
946     "melon": (0xFE, 0xBA, 0xAD),
947     "melrose": (0xC7, 0xC1, 0xFF),
948     "mercury": (0xE5, 0xE5, 0xE5),
949     "merino": (0xF6, 0xF0, 0xE6),
950     "merlin": (0x41, 0x3C, 0x37),
951     "merlot": (0x83, 0x19, 0x23),
952     "metallic bronze": (0x49, 0x37, 0x1B),
953     "metallic copper": (0x71, 0x29, 0x1D),
954     "meteor": (0xD0, 0x7D, 0x12),
955     "meteorite": (0x3C, 0x1F, 0x76),
956     "mexican red": (0xA7, 0x25, 0x25),
957     "mid gray": (0x5F, 0x5F, 0x6E),
958     "midnight blue": (0x00, 0x33, 0x66),
959     "midnight moss": (0x04, 0x10, 0x04),
960     "midnight": (0x01, 0x16, 0x35),
961     "mikado": (0x2D, 0x25, 0x10),
962     "milan": (0xFA, 0xFF, 0xA4),
963     "milano red": (0xB8, 0x11, 0x04),
964     "milk punch": (0xFF, 0xF6, 0xD4),
965     "millbrook": (0x59, 0x44, 0x33),
966     "mimosa": (0xF8, 0xFD, 0xD3),
967     "mindaro": (0xE3, 0xF9, 0x88),
968     "mine shaft": (0x32, 0x32, 0x32),
969     "mineral green": (0x3F, 0x5D, 0x53),
970     "ming": (0x36, 0x74, 0x7D),
971     "minsk": (0x3F, 0x30, 0x7F),
972     "mint cream": (0xF5, 0xFF, 0xF1),
973     "mint green": (0x98, 0xFF, 0x98),
974     "mint julep": (0xF1, 0xEE, 0xC1),
975     "mint tulip": (0xC4, 0xF4, 0xEB),
976     "mirage": (0x16, 0x19, 0x28),
977     "mischka": (0xD1, 0xD2, 0xDD),
978     "mist gray": (0xC4, 0xC4, 0xBC),
979     "misty rose": (0xFF, 0xE4, 0xE1),
980     "mobster": (0x7F, 0x75, 0x89),
981     "moccaccino": (0x6E, 0x1D, 0x14),
982     "moccasin": (0xFF, 0xE4, 0xB5),
983     "mocha": (0x78, 0x2D, 0x19),
984     "mojo": (0xC0, 0x47, 0x37),
985     "mona lisa": (0xFF, 0xA1, 0x94),
986     "monarch": (0x8B, 0x07, 0x23),
987     "mondo": (0x4A, 0x3C, 0x30),
988     "mongoose": (0xB5, 0xA2, 0x7F),
989     "monsoon": (0x8A, 0x83, 0x89),
990     "monte carlo": (0x83, 0xD0, 0xC6),
991     "monza": (0xC7, 0x03, 0x1E),
992     "moody blue": (0x7F, 0x76, 0xD3),
993     "moon glow": (0xFC, 0xFE, 0xDA),
994     "moon mist": (0xDC, 0xDD, 0xCC),
995     "moon raker": (0xD6, 0xCE, 0xF6),
996     "morning glory": (0x9E, 0xDE, 0xE0),
997     "morocco brown": (0x44, 0x1D, 0x00),
998     "mortar": (0x50, 0x43, 0x51),
999     "mosque": (0x03, 0x6A, 0x6E),
1000     "moss green": (0xAD, 0xDF, 0xAD),
1001     "mountain meadow": (0x1A, 0xB3, 0x85),
1002     "mountain mist": (0x95, 0x93, 0x96),
1003     "mountbatten pink": (0x99, 0x7A, 0x8D),
1004     "muddy waters": (0xB7, 0x8E, 0x5C),
1005     "muesli": (0xAA, 0x8B, 0x5B),
1006     "mulberry wood": (0x5C, 0x05, 0x36),
1007     "mulberry": (0xC5, 0x4B, 0x8C),
1008     "mule fawn": (0x8C, 0x47, 0x2F),
1009     "mulled wine": (0x4E, 0x45, 0x62),
1010     "mustard": (0xFF, 0xDB, 0x58),
1011     "my pink": (0xD6, 0x91, 0x88),
1012     "my sin": (0xFF, 0xB3, 0x1F),
1013     "mystic": (0xE2, 0xEB, 0xED),
1014     "nandor": (0x4B, 0x5D, 0x52),
1015     "napa": (0xAC, 0xA4, 0x94),
1016     "narvik": (0xED, 0xF9, 0xF1),
1017     "natural gray": (0x8B, 0x86, 0x80),
1018     "navajo white": (0xFF, 0xDE, 0xAD),
1019     "navy blue": (0x00, 0x00, 0x80),
1020     "navy": (0x00, 0x00, 0x80),
1021     "nebula": (0xCB, 0xDB, 0xD6),
1022     "negroni": (0xFF, 0xE2, 0xC5),
1023     "neon carrot": (0xFF, 0x99, 0x33),
1024     "nepal": (0x8E, 0xAB, 0xC1),
1025     "neptune": (0x7C, 0xB7, 0xBB),
1026     "nero": (0x14, 0x06, 0x00),
1027     "nevada": (0x64, 0x6E, 0x75),
1028     "new orleans": (0xF3, 0xD6, 0x9D),
1029     "new york pink": (0xD7, 0x83, 0x7F),
1030     "niagara": (0x06, 0xA1, 0x89),
1031     "night rider": (0x1F, 0x12, 0x0F),
1032     "night shadz": (0xAA, 0x37, 0x5A),
1033     "nile blue": (0x19, 0x37, 0x51),
1034     "nobel": (0xB7, 0xB1, 0xB1),
1035     "nomad": (0xBA, 0xB1, 0xA2),
1036     "norway": (0xA8, 0xBD, 0x9F),
1037     "nugget": (0xC5, 0x99, 0x22),
1038     "nutmeg wood finish": (0x68, 0x36, 0x00),
1039     "nutmeg": (0x81, 0x42, 0x2C),
1040     "oasis": (0xFE, 0xEF, 0xCE),
1041     "observatory": (0x02, 0x86, 0x6F),
1042     "ocean green": (0x41, 0xAA, 0x78),
1043     "ochre": (0xCC, 0x77, 0x22),
1044     "off green": (0xE6, 0xF8, 0xF3),
1045     "off yellow": (0xFE, 0xF9, 0xE3),
1046     "oil": (0x28, 0x1E, 0x15),
1047     "old brick": (0x90, 0x1E, 0x1E),
1048     "old copper": (0x72, 0x4A, 0x2F),
1049     "old gold": (0xCF, 0xB5, 0x3B),
1050     "old lace": (0xFD, 0xF5, 0xE6),
1051     "old lavender": (0x79, 0x68, 0x78),
1052     "old rose": (0xC0, 0x80, 0x81),
1053     "olive drab": (0x6B, 0x8E, 0x23),
1054     "olive green": (0xB5, 0xB3, 0x5C),
1055     "olive haze": (0x8B, 0x84, 0x70),
1056     "olive": (0x80, 0x80, 0x00),
1057     "olivetone": (0x71, 0x6E, 0x10),
1058     "olivine": (0x9A, 0xB9, 0x73),
1059     "onahau": (0xCD, 0xF4, 0xFF),
1060     "onion": (0x2F, 0x27, 0x0E),
1061     "opal": (0xA9, 0xC6, 0xC2),
1062     "opium": (0x8E, 0x6F, 0x70),
1063     "oracle": (0x37, 0x74, 0x75),
1064     "orange peel": (0xFF, 0xA0, 0x00),
1065     "orange red": (0xFF, 0x45, 0x00),
1066     "orange roughy": (0xC4, 0x57, 0x19),
1067     "orange white": (0xFE, 0xFC, 0xED),
1068     "orange": (0xFF, 0x68, 0x1F),
1069     "orchid white": (0xFF, 0xFD, 0xF3),
1070     "orchid": (0xDA, 0x70, 0xD6),
1071     "oregon": (0x9B, 0x47, 0x03),
1072     "orient": (0x01, 0x5E, 0x85),
1073     "oriental pink": (0xC6, 0x91, 0x91),
1074     "orinoco": (0xF3, 0xFB, 0xD4),
1075     "oslo gray": (0x87, 0x8D, 0x91),
1076     "ottoman": (0xE9, 0xF8, 0xED),
1077     "outer space": (0x2D, 0x38, 0x3A),
1078     "outrageous orange": (0xFF, 0x60, 0x37),
1079     "oxford blue": (0x38, 0x45, 0x55),
1080     "oxley": (0x77, 0x9E, 0x86),
1081     "oyster bay": (0xDA, 0xFA, 0xFF),
1082     "oyster pink": (0xE9, 0xCE, 0xCD),
1083     "paarl": (0xA6, 0x55, 0x29),
1084     "pablo": (0x77, 0x6F, 0x61),
1085     "pacific blue": (0x00, 0x9D, 0xC4),
1086     "pacifika": (0x77, 0x81, 0x20),
1087     "paco": (0x41, 0x1F, 0x10),
1088     "padua": (0xAD, 0xE6, 0xC4),
1089     "pale canary": (0xFF, 0xFF, 0x99),
1090     "pale goldenrod": (0xEE, 0xE8, 0xAA),
1091     "pale green": (0x98, 0xFB, 0x98),
1092     "pale leaf": (0xC0, 0xD3, 0xB9),
1093     "pale oyster": (0x98, 0x8D, 0x77),
1094     "pale prim": (0xFD, 0xFE, 0xB8),
1095     "pale rose": (0xFF, 0xE1, 0xF2),
1096     "pale sky": (0x6E, 0x77, 0x83),
1097     "pale slate": (0xC3, 0xBF, 0xC1),
1098     "pale turquoise": (0xAF, 0xEE, 0xEE),
1099     "pale violet red": (0xDB, 0x70, 0x93),
1100     "palm green": (0x09, 0x23, 0x0F),
1101     "palm leaf": (0x19, 0x33, 0x0E),
1102     "pampas": (0xF4, 0xF2, 0xEE),
1103     "panache": (0xEA, 0xF6, 0xEE),
1104     "pancho": (0xED, 0xCD, 0xAB),
1105     "papaya whip": (0xFF, 0xEF, 0xD5),
1106     "paprika": (0x8D, 0x02, 0x26),
1107     "paradiso": (0x31, 0x7D, 0x82),
1108     "parchment": (0xF1, 0xE9, 0xD2),
1109     "paris daisy": (0xFF, 0xF4, 0x6E),
1110     "paris m": (0x26, 0x05, 0x6A),
1111     "paris white": (0xCA, 0xDC, 0xD4),
1112     "parsley": (0x13, 0x4F, 0x19),
1113     "pastel green": (0x77, 0xDD, 0x77),
1114     "pastel pink": (0xFF, 0xD1, 0xDC),
1115     "patina": (0x63, 0x9A, 0x8F),
1116     "pattens blue": (0xDE, 0xF5, 0xFF),
1117     "paua": (0x26, 0x03, 0x68),
1118     "pavlova": (0xD7, 0xC4, 0x98),
1119     "peach cream": (0xFF, 0xF0, 0xDB),
1120     "peach orange": (0xFF, 0xCC, 0x99),
1121     "peach puff": (0xFF, 0xDA, 0xB9),
1122     "peach schnapps": (0xFF, 0xDC, 0xD6),
1123     "peach yellow": (0xFA, 0xDF, 0xAD),
1124     "peach": (0xFF, 0xE5, 0xB4),
1125     "peanut": (0x78, 0x2F, 0x16),
1126     "pear": (0xD1, 0xE2, 0x31),
1127     "pearl bush": (0xE8, 0xE0, 0xD5),
1128     "pearl lusta": (0xFC, 0xF4, 0xDC),
1129     "peat": (0x71, 0x6B, 0x56),
1130     "pelorous": (0x3E, 0xAB, 0xBF),
1131     "peppermint": (0xE3, 0xF5, 0xE1),
1132     "perano": (0xA9, 0xBE, 0xF2),
1133     "perfume": (0xD0, 0xBE, 0xF8),
1134     "periglacial blue": (0xE1, 0xE6, 0xD6),
1135     "periwinkle gray": (0xC3, 0xCD, 0xE6),
1136     "periwinkle": (0xCC, 0xCC, 0xFF),
1137     "persian blue": (0x1C, 0x39, 0xBB),
1138     "persian green": (0x00, 0xA6, 0x93),
1139     "persian indigo": (0x32, 0x12, 0x7A),
1140     "persian pink": (0xF7, 0x7F, 0xBE),
1141     "persian plum": (0x70, 0x1C, 0x1C),
1142     "persian red": (0xCC, 0x33, 0x33),
1143     "persian rose": (0xFE, 0x28, 0xA2),
1144     "persimmon": (0xFF, 0x6B, 0x53),
1145     "peru tan": (0x7F, 0x3A, 0x02),
1146     "peru": (0xCD, 0x85, 0x3F),
1147     "pesto": (0x7C, 0x76, 0x31),
1148     "petite orchid": (0xDB, 0x96, 0x90),
1149     "pewter": (0x96, 0xA8, 0xA1),
1150     "pharlap": (0xA3, 0x80, 0x7B),
1151     "picasso": (0xFF, 0xF3, 0x9D),
1152     "pickled bean": (0x6E, 0x48, 0x26),
1153     "pickled bluewood": (0x31, 0x44, 0x59),
1154     "picton blue": (0x45, 0xB1, 0xE8),
1155     "pig pink": (0xFD, 0xD7, 0xE4),
1156     "pigeon post": (0xAF, 0xBD, 0xD9),
1157     "pigment indigo": (0x4B, 0x00, 0x82),
1158     "pine cone": (0x6D, 0x5E, 0x54),
1159     "pine glade": (0xC7, 0xCD, 0x90),
1160     "pine green": (0x01, 0x79, 0x6F),
1161     "pine tree": (0x17, 0x1F, 0x04),
1162     "pink flamingo": (0xFF, 0x66, 0xFF),
1163     "pink flare": (0xE1, 0xC0, 0xC8),
1164     "pink lace": (0xFF, 0xDD, 0xF4),
1165     "pink lady": (0xFF, 0xF1, 0xD8),
1166     "pink salmon": (0xFF, 0x91, 0xA4),
1167     "pink swan": (0xBE, 0xB5, 0xB7),
1168     "pink": (0xFF, 0xC0, 0xCB),
1169     "piper": (0xC9, 0x63, 0x23),
1170     "pipi": (0xFE, 0xF4, 0xCC),
1171     "pippin": (0xFF, 0xE1, 0xDF),
1172     "pirate gold": (0xBA, 0x7F, 0x03),
1173     "pistachio": (0x9D, 0xC2, 0x09),
1174     "pixie green": (0xC0, 0xD8, 0xB6),
1175     "pizazz": (0xFF, 0x90, 0x00),
1176     "pizza": (0xC9, 0x94, 0x15),
1177     "plantation": (0x27, 0x50, 0x4B),
1178     "plum": (0x84, 0x31, 0x79),
1179     "pohutukawa": (0x8F, 0x02, 0x1C),
1180     "polar": (0xE5, 0xF9, 0xF6),
1181     "polo blue": (0x8D, 0xA8, 0xCC),
1182     "pomegranate": (0xF3, 0x47, 0x23),
1183     "pompadour": (0x66, 0x00, 0x45),
1184     "porcelain": (0xEF, 0xF2, 0xF3),
1185     "porsche": (0xEA, 0xAE, 0x69),
1186     "port gore": (0x25, 0x1F, 0x4F),
1187     "portafino": (0xFF, 0xFF, 0xB4),
1188     "portage": (0x8B, 0x9F, 0xEE),
1189     "portica": (0xF9, 0xE6, 0x63),
1190     "pot pourri": (0xF5, 0xE7, 0xE2),
1191     "potters clay": (0x8C, 0x57, 0x38),
1192     "powder ash": (0xBC, 0xC9, 0xC2),
1193     "powder blue": (0xB0, 0xE0, 0xE6),
1194     "prairie sand": (0x9A, 0x38, 0x20),
1195     "prelude": (0xD0, 0xC0, 0xE5),
1196     "prim": (0xF0, 0xE2, 0xEC),
1197     "primrose": (0xED, 0xEA, 0x99),
1198     "provincial pink": (0xFE, 0xF5, 0xF1),
1199     "prussian blue": (0x00, 0x31, 0x53),
1200     "puce": (0xCC, 0x88, 0x99),
1201     "pueblo": (0x7D, 0x2C, 0x14),
1202     "puerto rico": (0x3F, 0xC1, 0xAA),
1203     "pumice": (0xC2, 0xCA, 0xC4),
1204     "pumpkin skin": (0xB1, 0x61, 0x0B),
1205     "pumpkin": (0xFF, 0x75, 0x18),
1206     "punch": (0xDC, 0x43, 0x33),
1207     "punga": (0x4D, 0x3D, 0x14),
1208     "purple heart": (0x65, 0x2D, 0xC1),
1209     "purple mountain's majesty": (0x96, 0x78, 0xB6),
1210     "purple pizzazz": (0xFF, 0x00, 0xCC),
1211     "purple": (0x66, 0x00, 0x99),
1212     "putty": (0xE7, 0xCD, 0x8C),
1213     "quarter pearl lusta": (0xFF, 0xFD, 0xF4),
1214     "quarter spanish white": (0xF7, 0xF2, 0xE1),
1215     "quicksand": (0xBD, 0x97, 0x8E),
1216     "quill gray": (0xD6, 0xD6, 0xD1),
1217     "quincy": (0x62, 0x3F, 0x2D),
1218     "racing green": (0x0C, 0x19, 0x11),
1219     "radical red": (0xFF, 0x35, 0x5E),
1220     "raffia": (0xEA, 0xDA, 0xB8),
1221     "rainee": (0xB9, 0xC8, 0xAC),
1222     "rajah": (0xF7, 0xB6, 0x68),
1223     "rangitoto": (0x2E, 0x32, 0x22),
1224     "rangoon green": (0x1C, 0x1E, 0x13),
1225     "raven": (0x72, 0x7B, 0x89),
1226     "raw sienna": (0xD2, 0x7D, 0x46),
1227     "raw umber": (0x73, 0x4A, 0x12),
1228     "razzle dazzle rose": (0xFF, 0x33, 0xCC),
1229     "razzmatazz": (0xE3, 0x0B, 0x5C),
1230     "rebecca purple": (0x66, 0x33, 0x99),
1231     "rebel": (0x3C, 0x12, 0x06),
1232     "red beech": (0x7B, 0x38, 0x01),
1233     "red berry": (0x8E, 0x00, 0x00),
1234     "red damask": (0xDA, 0x6A, 0x41),
1235     "red devil": (0x86, 0x01, 0x11),
1236     "red orange": (0xFF, 0x3F, 0x34),
1237     "red oxide": (0x6E, 0x09, 0x02),
1238     "red ribbon": (0xED, 0x0A, 0x3F),
1239     "red robin": (0x80, 0x34, 0x1F),
1240     "red stage": (0xD0, 0x5F, 0x04),
1241     "red violet": (0xC7, 0x15, 0x85),
1242     "red": (0xFF, 0x00, 0x00),
1243     "redwood": (0x5D, 0x1E, 0x0F),
1244     "reef gold": (0x9F, 0x82, 0x1C),
1245     "reef": (0xC9, 0xFF, 0xA2),
1246     "regal blue": (0x01, 0x3F, 0x6A),
1247     "regent gray": (0x86, 0x94, 0x9F),
1248     "regent st blue": (0xAA, 0xD6, 0xE6),
1249     "remy": (0xFE, 0xEB, 0xF3),
1250     "reno sand": (0xA8, 0x65, 0x15),
1251     "resolution blue": (0x00, 0x23, 0x87),
1252     "revolver": (0x2C, 0x16, 0x32),
1253     "rhino": (0x2E, 0x3F, 0x62),
1254     "rice cake": (0xFF, 0xFE, 0xF0),
1255     "rice flower": (0xEE, 0xFF, 0xE2),
1256     "rich gold": (0xA8, 0x53, 0x07),
1257     "rio grande": (0xBB, 0xD0, 0x09),
1258     "ripe lemon": (0xF4, 0xD8, 0x1C),
1259     "ripe plum": (0x41, 0x00, 0x56),
1260     "riptide": (0x8B, 0xE6, 0xD8),
1261     "river bed": (0x43, 0x4C, 0x59),
1262     "rob roy": (0xEA, 0xC6, 0x74),
1263     "robin's egg blue": (0x00, 0xCC, 0xCC),
1264     "rock blue": (0x9E, 0xB1, 0xCD),
1265     "rock spray": (0xBA, 0x45, 0x0C),
1266     "rock": (0x4D, 0x38, 0x33),
1267     "rodeo dust": (0xC9, 0xB2, 0x9B),
1268     "rolling stone": (0x74, 0x7D, 0x83),
1269     "roman coffee": (0x79, 0x5D, 0x4C),
1270     "roman": (0xDE, 0x63, 0x60),
1271     "romance": (0xFF, 0xFE, 0xFD),
1272     "romantic": (0xFF, 0xD2, 0xB7),
1273     "ronchi": (0xEC, 0xC5, 0x4E),
1274     "roof terracotta": (0xA6, 0x2F, 0x20),
1275     "rope": (0x8E, 0x4D, 0x1E),
1276     "rose bud cherry": (0x80, 0x0B, 0x47),
1277     "rose bud": (0xFB, 0xB2, 0xA3),
1278     "rose fog": (0xE7, 0xBC, 0xB4),
1279     "rose of sharon": (0xBF, 0x55, 0x00),
1280     "rose white": (0xFF, 0xF6, 0xF5),
1281     "rose": (0xFF, 0x00, 0x7F),
1282     "rosewood": (0x65, 0x00, 0x0B),
1283     "rosy blue": (0xBC, 0x8F, 0x8F),
1284     "roti": (0xC6, 0xA8, 0x4B),
1285     "rouge": (0xA2, 0x3B, 0x6C),
1286     "royal blue": (0x41, 0x69, 0xE1),
1287     "royal heath": (0xAB, 0x34, 0x72),
1288     "royal purple": (0x6B, 0x3F, 0xA0),
1289     "rpi": (208, 95, 0),
1290     "rum swizzle": (0xF9, 0xF8, 0xE4),
1291     "rum": (0x79, 0x69, 0x89),
1292     "russet": (0x80, 0x46, 0x1B),
1293     "russett": (0x75, 0x5A, 0x57),
1294     "rust": (0xB7, 0x41, 0x0E),
1295     "rustic red": (0x48, 0x04, 0x04),
1296     "rusty nail": (0x86, 0x56, 0x0A),
1297     "saddle brown": (0x58, 0x34, 0x01),
1298     "saddle": (0x4C, 0x30, 0x24),
1299     "saffron mango": (0xF9, 0xBF, 0x58),
1300     "saffron": (0xF4, 0xC4, 0x30),
1301     "sage": (0x9E, 0xA5, 0x87),
1302     "sahara sand": (0xF1, 0xE7, 0x88),
1303     "sahara": (0xB7, 0xA2, 0x14),
1304     "sail": (0xB8, 0xE0, 0xF9),
1305     "salem": (0x09, 0x7F, 0x4B),
1306     "salmon": (0xFF, 0x8C, 0x69),
1307     "salomie": (0xFE, 0xDB, 0x8D),
1308     "salt box": (0x68, 0x5E, 0x6E),
1309     "saltpan": (0xF1, 0xF7, 0xF2),
1310     "sambuca": (0x3A, 0x20, 0x10),
1311     "san felix": (0x0B, 0x62, 0x07),
1312     "san juan": (0x30, 0x4B, 0x6A),
1313     "san marino": (0x45, 0x6C, 0xAC),
1314     "sand dune": (0x82, 0x6F, 0x65),
1315     "sandal": (0xAA, 0x8D, 0x6F),
1316     "sandrift": (0xAB, 0x91, 0x7A),
1317     "sandstone": (0x79, 0x6D, 0x62),
1318     "sandwisp": (0xF5, 0xE7, 0xA2),
1319     "sandy beach": (0xFF, 0xEA, 0xC8),
1320     "sandy brown": (0xF4, 0xA4, 0x60),
1321     "sangria": (0x92, 0x00, 0x0A),
1322     "sanguine brown": (0x8D, 0x3D, 0x38),
1323     "santa fe": (0xB1, 0x6D, 0x52),
1324     "santas gray": (0x9F, 0xA0, 0xB1),
1325     "sapling": (0xDE, 0xD4, 0xA4),
1326     "sapphire": (0x2F, 0x51, 0x9E),
1327     "saratoga": (0x55, 0x5B, 0x10),
1328     "satin linen": (0xE6, 0xE4, 0xD4),
1329     "sauvignon": (0xFF, 0xF5, 0xF3),
1330     "sazerac": (0xFF, 0xF4, 0xE0),
1331     "scampi": (0x67, 0x5F, 0xA6),
1332     "scandal": (0xCF, 0xFA, 0xF4),
1333     "scarlet gum": (0x43, 0x15, 0x60),
1334     "scarlet": (0xFF, 0x24, 0x00),
1335     "scarlett": (0x95, 0x00, 0x15),
1336     "scarpa flow": (0x58, 0x55, 0x62),
1337     "schist": (0xA9, 0xB4, 0x97),
1338     "school bus yellow": (0xFF, 0xD8, 0x00),
1339     "schooner": (0x8B, 0x84, 0x7E),
1340     "science blue": (0x00, 0x66, 0xCC),
1341     "scooter": (0x2E, 0xBF, 0xD4),
1342     "scorpion": (0x69, 0x5F, 0x62),
1343     "scotch mist": (0xFF, 0xFB, 0xDC),
1344     "screamin' green": (0x66, 0xFF, 0x66),
1345     "screamin green": (0x66, 0xFF, 0x66),
1346     "screaming green": (0x66, 0xFF, 0x66),
1347     "sea buckthorn": (0xFB, 0xA1, 0x29),
1348     "sea green": (0x2E, 0x8B, 0x57),
1349     "sea mist": (0xC5, 0xDB, 0xCA),
1350     "sea nymph": (0x78, 0xA3, 0x9C),
1351     "sea pink": (0xED, 0x98, 0x9E),
1352     "seagull": (0x80, 0xCC, 0xEA),
1353     "seance": (0x73, 0x1E, 0x8F),
1354     "seashell peach": (0xFF, 0xF5, 0xEE),
1355     "seashell": (0xF1, 0xF1, 0xF1),
1356     "seaweed": (0x1B, 0x2F, 0x11),
1357     "selago": (0xF0, 0xEE, 0xFD),
1358     "selective yellow": (0xFF, 0xBA, 0x00),
1359     "sepia black": (0x2B, 0x02, 0x02),
1360     "sepia skin": (0x9E, 0x5B, 0x40),
1361     "sepia": (0x70, 0x42, 0x14),
1362     "serenade": (0xFF, 0xF4, 0xE8),
1363     "shadow green": (0x9A, 0xC2, 0xB8),
1364     "shadow": (0x83, 0x70, 0x50),
1365     "shady lady": (0xAA, 0xA5, 0xA9),
1366     "shakespeare": (0x4E, 0xAB, 0xD1),
1367     "shalimar": (0xFB, 0xFF, 0xBA),
1368     "shamrock": (0x33, 0xCC, 0x99),
1369     "shark": (0x25, 0x27, 0x2C),
1370     "sherpa blue": (0x00, 0x49, 0x50),
1371     "sherwood green": (0x02, 0x40, 0x2C),
1372     "shilo": (0xE8, 0xB9, 0xB3),
1373     "shingle fawn": (0x6B, 0x4E, 0x31),
1374     "ship cove": (0x78, 0x8B, 0xBA),
1375     "ship gray": (0x3E, 0x3A, 0x44),
1376     "shiraz": (0xB2, 0x09, 0x31),
1377     "shocking pink": (0xFC, 0x0F, 0xC0),
1378     "shocking": (0xE2, 0x92, 0xC0),
1379     "shuttle gray": (0x5F, 0x66, 0x72),
1380     "siam": (0x64, 0x6A, 0x54),
1381     "sidecar": (0xF3, 0xE7, 0xBB),
1382     "sienna": (0xA0, 0x52, 0x2D),
1383     "silk": (0xBD, 0xB1, 0xA8),
1384     "silver chalice": (0xAC, 0xAC, 0xAC),
1385     "silver rust": (0xC9, 0xC0, 0xBB),
1386     "silver sand": (0xBF, 0xC1, 0xC2),
1387     "silver tree": (0x66, 0xB5, 0x8F),
1388     "silver": (0xC0, 0xC0, 0xC0),
1389     "sinbad": (0x9F, 0xD7, 0xD3),
1390     "siren": (0x7A, 0x01, 0x3A),
1391     "sirocco": (0x71, 0x80, 0x80),
1392     "sisal": (0xD3, 0xCB, 0xBA),
1393     "skeptic": (0xCA, 0xE6, 0xDA),
1394     "sky blue": (0x76, 0xD7, 0xEA),
1395     "slate blue": (0x6A, 0x5A, 0xCD),
1396     "slate gray": (0x70, 0x80, 0x90),
1397     "smalt blue": (0x51, 0x80, 0x8F),
1398     "smalt": (0x00, 0x33, 0x99),
1399     "smoky": (0x60, 0x5B, 0x73),
1400     "snow drift": (0xF7, 0xFA, 0xF7),
1401     "snow flurry": (0xE4, 0xFF, 0xD1),
1402     "snow": (0xFF, 0xFA, 0xFA),
1403     "snowy mint": (0xD6, 0xFF, 0xDB),
1404     "snuff": (0xE2, 0xD8, 0xED),
1405     "soapstone": (0xFF, 0xFB, 0xF9),
1406     "soft amber": (0xD1, 0xC6, 0xB4),
1407     "soft peach": (0xF5, 0xED, 0xEF),
1408     "solid pink": (0x89, 0x38, 0x43),
1409     "solitaire": (0xFE, 0xF8, 0xE2),
1410     "solitude": (0xEA, 0xF6, 0xFF),
1411     "sorbus": (0xFD, 0x7C, 0x07),
1412     "sorrell brown": (0xCE, 0xB9, 0x8F),
1413     "soya bean": (0x6A, 0x60, 0x51),
1414     "spanish green": (0x81, 0x98, 0x85),
1415     "spectra": (0x2F, 0x5A, 0x57),
1416     "spice": (0x6A, 0x44, 0x2E),
1417     "spicy mix": (0x88, 0x53, 0x42),
1418     "spicy mustard": (0x74, 0x64, 0x0D),
1419     "spicy pink": (0x81, 0x6E, 0x71),
1420     "spindle": (0xB6, 0xD1, 0xEA),
1421     "spray": (0x79, 0xDE, 0xEC),
1422     "spring green": (0x00, 0xFF, 0x7F),
1423     "spring leaves": (0x57, 0x83, 0x63),
1424     "spring rain": (0xAC, 0xCB, 0xB1),
1425     "spring sun": (0xF6, 0xFF, 0xDC),
1426     "spring wood": (0xF8, 0xF6, 0xF1),
1427     "sprout": (0xC1, 0xD7, 0xB0),
1428     "spun pearl": (0xAA, 0xAB, 0xB7),
1429     "squirrel": (0x8F, 0x81, 0x76),
1430     "st tropaz": (0x2D, 0x56, 0x9B),
1431     "stack": (0x8A, 0x8F, 0x8A),
1432     "star dust": (0x9F, 0x9F, 0x9C),
1433     "stark white": (0xE5, 0xD7, 0xBD),
1434     "starship": (0xEC, 0xF2, 0x45),
1435     "steel blue": (0x46, 0x82, 0xB4),
1436     "steel gray": (0x26, 0x23, 0x35),
1437     "stiletto": (0x9C, 0x33, 0x36),
1438     "stonewall": (0x92, 0x85, 0x73),
1439     "storm dust": (0x64, 0x64, 0x63),
1440     "storm gray": (0x71, 0x74, 0x86),
1441     "stratos": (0x00, 0x07, 0x41),
1442     "straw": (0xD4, 0xBF, 0x8D),
1443     "strikemaster": (0x95, 0x63, 0x87),
1444     "stromboli": (0x32, 0x5D, 0x52),
1445     "studio": (0x71, 0x4A, 0xB2),
1446     "submarine": (0xBA, 0xC7, 0xC9),
1447     "sugar cane": (0xF9, 0xFF, 0xF6),
1448     "sulu": (0xC1, 0xF0, 0x7C),
1449     "summer green": (0x96, 0xBB, 0xAB),
1450     "sun": (0xFB, 0xAC, 0x13),
1451     "sundance": (0xC9, 0xB3, 0x5B),
1452     "sundown": (0xFF, 0xB1, 0xB3),
1453     "sunflower": (0xE4, 0xD4, 0x22),
1454     "sunglo": (0xE1, 0x68, 0x65),
1455     "sunglow": (0xFF, 0xCC, 0x33),
1456     "sunset orange": (0xFE, 0x4C, 0x40),
1457     "sunshade": (0xFF, 0x9E, 0x2C),
1458     "supernova": (0xFF, 0xC9, 0x01),
1459     "surf crest": (0xCF, 0xE5, 0xD2),
1460     "surf": (0xBB, 0xD7, 0xC1),
1461     "surfie green": (0x0C, 0x7A, 0x79),
1462     "sushi": (0x87, 0xAB, 0x39),
1463     "suva gray": (0x88, 0x83, 0x87),
1464     "swamp green": (0xAC, 0xB7, 0x8E),
1465     "swamp": (0x00, 0x1B, 0x1C),
1466     "swans down": (0xDC, 0xF0, 0xEA),
1467     "sweet corn": (0xFB, 0xEA, 0x8C),
1468     "sweet pink": (0xFD, 0x9F, 0xA2),
1469     "swirl": (0xD3, 0xCD, 0xC5),
1470     "swiss coffee": (0xDD, 0xD6, 0xD5),
1471     "sycamore": (0x90, 0x8D, 0x39),
1472     "tabasco": (0xA0, 0x27, 0x12),
1473     "tacao": (0xED, 0xB3, 0x81),
1474     "tacha": (0xD6, 0xC5, 0x62),
1475     "tahiti gold": (0xE9, 0x7C, 0x07),
1476     "tahuna sands": (0xEE, 0xF0, 0xC8),
1477     "tall poppy": (0xB3, 0x2D, 0x29),
1478     "tallow": (0xA8, 0xA5, 0x89),
1479     "tamarillo": (0x99, 0x16, 0x13),
1480     "tamarind": (0x34, 0x15, 0x15),
1481     "tan hide": (0xFA, 0x9D, 0x5A),
1482     "tan": (0xD2, 0xB4, 0x8C),
1483     "tana": (0xD9, 0xDC, 0xC1),
1484     "tangaroa": (0x03, 0x16, 0x3C),
1485     "tangerine": (0xF2, 0x85, 0x00),
1486     "tango": (0xED, 0x7A, 0x1C),
1487     "tapa": (0x7B, 0x78, 0x74),
1488     "tapestry": (0xB0, 0x5E, 0x81),
1489     "tara": (0xE1, 0xF6, 0xE8),
1490     "tarawera": (0x07, 0x3A, 0x50),
1491     "tasman": (0xCF, 0xDC, 0xCF),
1492     "taupe gray": (0xB3, 0xAF, 0x95),
1493     "taupe": (0x48, 0x3C, 0x32),
1494     "tawny port": (0x69, 0x25, 0x45),
1495     "te papa green": (0x1E, 0x43, 0x3C),
1496     "tea green": (0xD0, 0xF0, 0xC0),
1497     "tea": (0xC1, 0xBA, 0xB0),
1498     "teak": (0xB1, 0x94, 0x61),
1499     "teal blue": (0x04, 0x42, 0x59),
1500     "teal": (0x00, 0x80, 0x80),
1501     "temptress": (0x3B, 0x00, 0x0B),
1502     "tenn": (0xCD, 0x57, 0x00),
1503     "tequila": (0xFF, 0xE6, 0xC7),
1504     "terracotta": (0xE2, 0x72, 0x5B),
1505     "texas rose": (0xFF, 0xB5, 0x55),
1506     "texas": (0xF8, 0xF9, 0x9C),
1507     "thatch green": (0x40, 0x3D, 0x19),
1508     "thatch": (0xB6, 0x9D, 0x98),
1509     "thistle green": (0xCC, 0xCA, 0xA8),
1510     "thistle": (0xD8, 0xBF, 0xD8),
1511     "thunder": (0x33, 0x29, 0x2F),
1512     "thunderbird": (0xC0, 0x2B, 0x18),
1513     "tia maria": (0xC1, 0x44, 0x0E),
1514     "tiara": (0xC3, 0xD1, 0xD1),
1515     "tiber": (0x06, 0x35, 0x37),
1516     "tickle me pink": (0xFC, 0x80, 0xA5),
1517     "tidal": (0xF1, 0xFF, 0xAD),
1518     "tide": (0xBF, 0xB8, 0xB0),
1519     "timber green": (0x16, 0x32, 0x2C),
1520     "timberwolf": (0xD9, 0xD6, 0xCF),
1521     "titan white": (0xF0, 0xEE, 0xFF),
1522     "toast": (0x9A, 0x6E, 0x61),
1523     "tobacco brown": (0x71, 0x5D, 0x47),
1524     "toledo": (0x3A, 0x00, 0x20),
1525     "tolopea": (0x1B, 0x02, 0x45),
1526     "tom thumb": (0x3F, 0x58, 0x3B),
1527     "tomato": (0xFF, 0x63, 0x47),
1528     "tonys pink": (0xE7, 0x9F, 0x8C),
1529     "topaz": (0x7C, 0x77, 0x8A),
1530     "torch red": (0xFD, 0x0E, 0x35),
1531     "torea bay": (0x0F, 0x2D, 0x9E),
1532     "tory blue": (0x14, 0x50, 0xAA),
1533     "tosca": (0x8D, 0x3F, 0x3F),
1534     "totem pole": (0x99, 0x1B, 0x07),
1535     "tower gray": (0xA9, 0xBD, 0xBF),
1536     "tradewind": (0x5F, 0xB3, 0xAC),
1537     "tranquil": (0xE6, 0xFF, 0xFF),
1538     "travertine": (0xFF, 0xFD, 0xE8),
1539     "tree poppy": (0xFC, 0x9C, 0x1D),
1540     "treehouse": (0x3B, 0x28, 0x20),
1541     "trendy green": (0x7C, 0x88, 0x1A),
1542     "trendy pink": (0x8C, 0x64, 0x95),
1543     "trinidad": (0xE6, 0x4E, 0x03),
1544     "tropical blue": (0xC3, 0xDD, 0xF9),
1545     "tropical rain forest": (0x00, 0x75, 0x5E),
1546     "trout": (0x4A, 0x4E, 0x5A),
1547     "true v": (0x8A, 0x73, 0xD6),
1548     "tuatara": (0x36, 0x35, 0x34),
1549     "tuft bush": (0xFF, 0xDD, 0xCD),
1550     "tulip tree": (0xEA, 0xB3, 0x3B),
1551     "tumbleweed": (0xDE, 0xA6, 0x81),
1552     "tuna": (0x35, 0x35, 0x42),
1553     "tundora": (0x4A, 0x42, 0x44),
1554     "turbo": (0xFA, 0xE6, 0x00),
1555     "turkish rose": (0xB5, 0x72, 0x81),
1556     "turmeric": (0xCA, 0xBB, 0x48),
1557     "turquoise blue": (0x6C, 0xDA, 0xE7),
1558     "turquoise": (0x30, 0xD5, 0xC8),
1559     "turtle green": (0x2A, 0x38, 0x0B),
1560     "tuscany": (0xBD, 0x5E, 0x2E),
1561     "tusk": (0xEE, 0xF3, 0xC3),
1562     "tussock": (0xC5, 0x99, 0x4B),
1563     "tutu": (0xFF, 0xF1, 0xF9),
1564     "twilight blue": (0xEE, 0xFD, 0xFF),
1565     "twilight": (0xE4, 0xCF, 0xDE),
1566     "twine": (0xC2, 0x95, 0x5D),
1567     "tyrian purple": (0x66, 0x02, 0x3C),
1568     "ultramarine": (0x12, 0x0A, 0x8F),
1569     "valencia": (0xD8, 0x44, 0x37),
1570     "valentino": (0x35, 0x0E, 0x42),
1571     "valhalla": (0x2B, 0x19, 0x4F),
1572     "van cleef": (0x49, 0x17, 0x0C),
1573     "vanilla ice": (0xF3, 0xD9, 0xDF),
1574     "vanilla": (0xD1, 0xBE, 0xA8),
1575     "varden": (0xFF, 0xF6, 0xDF),
1576     "venetian red": (0x72, 0x01, 0x0F),
1577     "venice blue": (0x05, 0x59, 0x89),
1578     "venus": (0x92, 0x85, 0x90),
1579     "verdigris": (0x5D, 0x5E, 0x37),
1580     "verdun green": (0x49, 0x54, 0x00),
1581     "vermilion": (0xFF, 0x4D, 0x00),
1582     "vesuvius": (0xB1, 0x4A, 0x0B),
1583     "victoria": (0x53, 0x44, 0x91),
1584     "vida loca": (0x54, 0x90, 0x19),
1585     "viking": (0x64, 0xCC, 0xDB),
1586     "vin rouge": (0x98, 0x3D, 0x61),
1587     "viola": (0xCB, 0x8F, 0xA9),
1588     "violent violet": (0x29, 0x0C, 0x5E),
1589     "violet eggplant": (0x99, 0x11, 0x99),
1590     "violet red": (0xF7, 0x46, 0x8A),
1591     "violet": (0x24, 0x0A, 0x40),
1592     "viridian green": (0x67, 0x89, 0x75),
1593     "viridian": (0x40, 0x82, 0x6D),
1594     "vis vis": (0xFF, 0xEF, 0xA1),
1595     "vista blue": (0x8F, 0xD6, 0xB4),
1596     "vista white": (0xFC, 0xF8, 0xF7),
1597     "vivid tangerine": (0xFF, 0x99, 0x80),
1598     "vivid violet": (0x80, 0x37, 0x90),
1599     "voodoo": (0x53, 0x34, 0x55),
1600     "vulcan": (0x10, 0x12, 0x1D),
1601     "wafer": (0xDE, 0xCB, 0xC6),
1602     "waikawa gray": (0x5A, 0x6E, 0x9C),
1603     "waiouru": (0x36, 0x3C, 0x0D),
1604     "walnut": (0x77, 0x3F, 0x1A),
1605     "wannabe.house": (0x00, 0x00, 95),
1606     "wasabi": (0x78, 0x8A, 0x25),
1607     "water leaf": (0xA1, 0xE9, 0xDE),
1608     "watercourse": (0x05, 0x6F, 0x57),
1609     "waterloo ": (0x7B, 0x7C, 0x94),
1610     "wattle": (0xDC, 0xD7, 0x47),
1611     "watusi": (0xFF, 0xDD, 0xCF),
1612     "wax flower": (0xFF, 0xC0, 0xA8),
1613     "we peep": (0xF7, 0xDB, 0xE6),
1614     "web orange": (0xFF, 0xA5, 0x00),
1615     "wedgewood": (0x4E, 0x7F, 0x9E),
1616     "well read": (0xB4, 0x33, 0x32),
1617     "west coast": (0x62, 0x51, 0x19),
1618     "west side": (0xFF, 0x91, 0x0F),
1619     "westar": (0xDC, 0xD9, 0xD2),
1620     "wewak": (0xF1, 0x9B, 0xAB),
1621     "wheat": (0xF5, 0xDE, 0xB3),
1622     "wheatfield": (0xF3, 0xED, 0xCF),
1623     "whiskey": (0xD5, 0x9A, 0x6F),
1624     "whisper": (0xF7, 0xF5, 0xFA),
1625     "white ice": (0xDD, 0xF9, 0xF1),
1626     "white lilac": (0xF8, 0xF7, 0xFC),
1627     "white linen": (0xF8, 0xF0, 0xE8),
1628     "white pointer": (0xFE, 0xF8, 0xFF),
1629     "white rock": (0xEA, 0xE8, 0xD4),
1630     "white smoke": (0xF5, 0xF5, 0xF5),
1631     "white": (0xFF, 0xFF, 0xFF),
1632     "wild blue yonder": (0x7A, 0x89, 0xB8),
1633     "wild rice": (0xEC, 0xE0, 0x90),
1634     "wild sand": (0xF4, 0xF4, 0xF4),
1635     "wild strawberry": (0xFF, 0x33, 0x99),
1636     "wild watermelon": (0xFD, 0x5B, 0x78),
1637     "wild willow": (0xB9, 0xC4, 0x6A),
1638     "william": (0x3A, 0x68, 0x6C),
1639     "willow brook": (0xDF, 0xEC, 0xDA),
1640     "willow grove": (0x65, 0x74, 0x5D),
1641     "windsor": (0x3C, 0x08, 0x78),
1642     "wine berry": (0x59, 0x1D, 0x35),
1643     "winter hazel": (0xD5, 0xD1, 0x95),
1644     "wisp pink": (0xFE, 0xF4, 0xF8),
1645     "wisteria": (0x97, 0x71, 0xB5),
1646     "wistful": (0xA4, 0xA6, 0xD3),
1647     "witch haze": (0xFF, 0xFC, 0x99),
1648     "wood bark": (0x26, 0x11, 0x05),
1649     "woodland": (0x4D, 0x53, 0x28),
1650     "woodrush": (0x30, 0x2A, 0x0F),
1651     "woodsmoke": (0x0C, 0x0D, 0x0F),
1652     "woody brown": (0x48, 0x31, 0x31),
1653     "xanadu": (0x73, 0x86, 0x78),
1654     "yellow green": (0xC5, 0xE1, 0x7A),
1655     "yellow metal": (0x71, 0x63, 0x38),
1656     "yellow orange": (0xFF, 0xAE, 0x42),
1657     "yellow sea": (0xFE, 0xA9, 0x04),
1658     "yellow": (0xFF, 0xFF, 0x00),
1659     "your pink": (0xFF, 0xC3, 0xC0),
1660     "yukon gold": (0x7B, 0x66, 0x08),
1661     "yuma": (0xCE, 0xC2, 0x91),
1662     "zambezi": (0x68, 0x55, 0x58),
1663     "zanah": (0xDA, 0xEC, 0xD6),
1664     "zest": (0xE5, 0x84, 0x1B),
1665     "zeus": (0x29, 0x23, 0x19),
1666     "ziggurat": (0xBF, 0xDB, 0xE2),
1667     "zinnwaldite": (0xEB, 0xC2, 0xAF),
1668     "zircon": (0xF4, 0xF8, 0xFF),
1669     "zombie": (0xE4, 0xD6, 0x9B),
1670     "zorba": (0xA5, 0x9B, 0x91),
1671     "zuccini": (0x04, 0x40, 0x22),
1672     "zumthor": (0xED, 0xF6, 0xFF),
1673 }
1674
1675
1676 def clear() -> str:
1677     """Returns:
1678     An ANSI escape sequence that clears the screen.
1679     """
1680     return "\x1B[H\x1B[2J"
1681
1682
1683 def clear_screen() -> str:
1684     """Returns:
1685     An ANSI escape sequence that clears the screen.
1686     """
1687     return clear()
1688
1689
1690 def clear_line() -> str:
1691     """Returns:
1692     An ANSI escape sequence that clears the current line from the cursor
1693     position to the end of the line.
1694     """
1695     return "\x1B[2K\r"
1696
1697
1698 def reset() -> str:
1699     """Returns:
1700         An ANSI escape sequence that resets text attributes to 'normal'.  This
1701         sequence ends any different foreground or background color settings.
1702         It also ends any special text styling (italics, bold, underline, etc...)
1703         that have been previously set.
1704
1705     See also :py:meth:`reset_bg` and :py:meth:`reset_fg`.
1706     """
1707     return "\x1B[m"
1708
1709
1710 def normal() -> str:
1711     """Returns:
1712         An ANSI escape sequence that resets text attributes to 'normal'.  This
1713         sequence ends any different foreground or background color settings.
1714         It also ends any special text styling (italics, bold, underline, etc...)
1715         that have been previously set.
1716
1717     See also :py:meth:`reset_bg` and :py:meth:`reset_fg`.
1718     """
1719     return reset()
1720
1721
1722 def bold() -> str:
1723     """Returns:
1724     The ANSI escape sequence to set text to bold weight.
1725     """
1726     return "\x1B[1m"
1727
1728
1729 def italic() -> str:
1730     """Returns:
1731     The ANSI escape sequence to set text to italics style.
1732     """
1733     return "\x1B[3m"
1734
1735
1736 def italics() -> str:
1737     """Returns:
1738     The ANSI escape sequence to set text to italics style.
1739     """
1740     return italic()
1741
1742
1743 def underline() -> str:
1744     """Returns:
1745     The ANSI escape sequence to set text to underlined style.
1746     """
1747     return "\x1B[4m"
1748
1749
1750 def strikethrough() -> str:
1751     """Returns:
1752     The ANSI escape sequence to set text to strike-through mode.
1753     """
1754     return "\x1B[9m"
1755
1756
1757 def strike_through() -> str:
1758     """Returns:
1759     The ANSI escape sequence to set text to strike-through mode.
1760     """
1761     return strikethrough()
1762
1763
1764 def _is_16color(num: int) -> bool:
1765     """One ANSI escape sequences (^[[#m) can be used to change text
1766     foreground and background color if and only if the R, G and B
1767     numbers are 128 or 255.  This means this code can be used to
1768     create 16 colors.
1769     """
1770     return num in {255, 128}
1771
1772
1773 def _is_216color(num: int) -> bool:
1774     """Another ANSI escape sequence (^[[38;5;#m) can be used to change
1775     text color to 216 separate color values with each of R, G and B
1776     one of 6 possible values."""
1777     return num in set([0, 95, 135, 175, 223, 255])
1778
1779
1780 def _simple_color_number(red: int, green: int, blue: int) -> int:
1781     """Construct a simple color number.  This is a 3 bit number
1782     used to construct a 16-color escape code."""
1783     r = red > 0
1784     g = green > 0
1785     b = blue > 0
1786     return b << 2 | g << 1 | r
1787
1788
1789 def fg_16color(red: int, green: int, blue: int) -> str:
1790     """
1791     Set text foreground color to a color in 16-color space.
1792
1793     Args:
1794         red: the red channel value of the foreground color to set
1795         green: the green channel value of the foreground color to set
1796         blue: the blue channel value of the foreground color to set
1797
1798     Returns:
1799         An ANSI escape code that sets the foreground color described
1800         by the red, green and blue from the 16 color space.
1801
1802     .. note::
1803
1804         In 16 color mode, the possible color values are limited to
1805         red, green, yellow, blue, purple, cyan, white and black
1806         each with or without a "bright" attribute.  This function
1807         takes R/G/B parameter values that can be used to describe
1808         colors that can't be represented in 16-color space.  If
1809         such a color is described by the parameters, it maps the
1810         color to its closest representation in 16-color space.
1811
1812     This is used by :py:meth:`fg` internally but can be called
1813     directly too.  See also :py:meth:`fg_216color`,
1814     :py:meth:`fg_24bit`, and :py:meth:`bg_16color`.
1815     """
1816
1817     code = _simple_color_number(red, green, blue) + 30
1818     bright_count = 0
1819     if red > 128:
1820         bright_count += 1
1821     if green > 128:
1822         bright_count += 1
1823     if blue > 128:
1824         bright_count += 1
1825     if bright_count > 1:
1826         code += 60
1827     return f"\x1B[{code}m"
1828
1829
1830 def bg_16color(red: int, green: int, blue: int) -> str:
1831     """
1832     Set text background color to a color in 16-color space.
1833
1834     Args:
1835         red: the red channel value of background color to set
1836         green: the green channel value of the background color to set
1837         blue: the blue channel value of the background color to set
1838
1839     Returns:
1840         An ANSI escape sequence that sets the background color to the
1841         color described by the red, green and blue parameters in the
1842         16 color space.
1843
1844     .. note::
1845
1846         In 16 color mode, the possible color values are limited to
1847         red, green, yellow, blue, purple, cyan, white and black
1848         each with or without a "bright" attribute.  This function
1849         takes R/G/B parameter values that can be used to describe
1850         colors that can't be represented in 16-color space.  If
1851         such a color is described by the parameters, it maps the
1852         color to its closest representation in 16-color space.
1853
1854     This is used by :py:meth:`bg` internally but can be invoked
1855     directly if needed.  See also :py:meth:`fg_16color`,
1856     :py:meth:`bg_216color`, and :py:meth:`bg_24bit`.
1857     """
1858
1859     code = _simple_color_number(red, green, blue) + 40
1860     bright_count = 0
1861     if red > 128:
1862         bright_count += 1
1863     if green > 128:
1864         bright_count += 1
1865     if blue > 128:
1866         bright_count += 1
1867     if bright_count > 1:
1868         code += 60
1869     return f"\x1B[{code}m"
1870
1871
1872 def _pixel_to_216color(n: int) -> int:
1873     """Help convert full RGB color descriptions into valid 216 color space"""
1874     if n >= 255:
1875         return 5
1876     if n >= 233:
1877         return 4
1878     if n >= 175:
1879         return 3
1880     if n >= 135:
1881         return 2
1882     if n >= 95:
1883         return 1
1884     return 0
1885
1886
1887 def fg_216color(red: int, green: int, blue: int) -> str:
1888     """
1889     Set text foreground color to a color in 216 color space.
1890
1891     Args:
1892         red: the red channel value of the foreground color to set
1893         green: the green channel value of the foreground color to set
1894         blue: the blue channel value of the foreground color to set
1895
1896     Returns:
1897         An ANSI escape code that sets the foreground color described
1898         by the red, green and blue from the 216 color space.
1899
1900     .. note::
1901
1902         In 216 color mode there are 216 total colors available.
1903         This is less than the 16M (256^3) possibilities that can
1904         be described by full RGB tuples.  When passed colors that
1905         are not available in 216 color mode, this code finds the
1906         closest match in 216 color space and returns that.
1907
1908     This is used by :py:meth:`fg` internally but can be invoked
1909     directly if needed.  See also :py:meth:`fg_16color`,
1910     :py:meth`fg_24bit`, and :py:meth:`bg_216color`.
1911     """
1912     r = _pixel_to_216color(red)
1913     g = _pixel_to_216color(green)
1914     b = _pixel_to_216color(blue)
1915     code = 16 + r * 36 + g * 6 + b
1916     return f"\x1B[38;5;{code}m"
1917
1918
1919 def bg_216color(red: int, green: int, blue: int) -> str:
1920     """
1921     Set text background color to a color in 216 color space.
1922
1923     Args:
1924         red: the red channel value of the background color to set
1925         green: the green channel value of the background color to set
1926         blue: the blue channel value of the foreground color to set
1927
1928     Returns:
1929         An ANSI escape code that sets the background color described
1930         by the red, green and blue from the 216 color space.
1931
1932     .. note::
1933
1934         In 216 color mode there are 216 total colors available.
1935         This is less than the 16M (256^3) possibilities that can
1936         be described by full RGB tuples.  When passed colors that
1937         are not available in 216 color mode, this code finds the
1938         closest match in 216 color space and returns that.
1939
1940     This is used by :py:meth:`bg` internally but can be invoked
1941     directly if needed.  See also :py:meth:`bg_16color`,
1942     :py:meth:`bg_24bit`, and :py:meth:`fg_216color`.
1943     """
1944     r = _pixel_to_216color(red)
1945     g = _pixel_to_216color(green)
1946     b = _pixel_to_216color(blue)
1947     code = 16 + r * 36 + g * 6 + b
1948     return f"\x1B[48;5;{code}m"
1949
1950
1951 def _pixel_to_24bit_color(value: int) -> int:
1952     """Helper to ensure a color channel value is valid in 24-bit color space."""
1953     if value < 0:
1954         return 0
1955     if value > 255:
1956         return 255
1957     return value
1958
1959
1960 def fg_24bit(red: int, green: int, blue: int) -> str:
1961     """
1962     Set text foreground color to a color in 24-bit color space.
1963
1964     Args:
1965         red: the red channel value of the foreground color to set
1966         green: the green channel value of the foreground color to set
1967         blue: the blue channel value of the foreground color to set
1968
1969     Returns:
1970         An ANSI escape code that sets the foreground color described
1971         by the red, green and blue from 24-bit color space.
1972
1973     .. note::
1974
1975         In 24-bit color space we can represent any color described
1976         by red, green or blue values where 0 <= value <= 255.
1977         Values outside of this range will be mapped into the 24-bit
1978         color space.
1979
1980     This is used by :py:meth:`fg` internally but can be invoked directly
1981     if useful.  See also :py:meth:`fg_216color` and :py:meth:`bg_24bit`.
1982     """
1983     return f"\x1B[38;2;{_pixel_to_24bit_color(red)};{_pixel_to_24bit_color(green)};{_pixel_to_24bit_color(blue)}m"
1984
1985
1986 def bg_24bit(red: int, green: int, blue: int) -> str:
1987     """
1988     Set text background color to a color in 24-bit color space.
1989
1990     Args:
1991         red: the red channel value of the background color to set
1992         green: the green channel value of the backgrounf color to set
1993         blue: the blue channel value of the background color to set
1994
1995     Returns:
1996         An ANSI escape code that sets the background color described
1997         by the red, green and blue from 24-bit color space.
1998
1999     .. note::
2000
2001         In 24-bit color space we can represent any color described
2002         by red, green or blue values where 0 <= value <= 255.
2003         Values outside of this range will be mapped into the 24-bit
2004         color space.
2005
2006     This is used by :py:meth:`fg` internally but can be invoked directly
2007     if useful.  See also :py:meth:`fg_216color` and :py:meth:`bg_24bit`.
2008     """
2009     return f"\x1B[48;2;{_pixel_to_24bit_color(red)};{_pixel_to_24bit_color(green)};{_pixel_to_24bit_color(blue)}m"
2010
2011
2012 def _find_color_by_name(name: str) -> Tuple[int, int, int]:
2013     """Given a color name, look up its RGB channel values from the COLOR_NAMES_TO_RGB
2014     table."""
2015     rgb = COLOR_NAMES_TO_RGB.get(name.lower(), None)
2016     if rgb is None:
2017         name = _guess_name(name)
2018         rgb = COLOR_NAMES_TO_RGB.get(name.lower(), None)
2019         assert rgb is not None
2020     return rgb
2021
2022
2023 @logging_utils.squelch_repeated_log_messages(1)
2024 def fg(
2025     name: Optional[str] = "",
2026     red: Optional[int] = None,
2027     green: Optional[int] = None,
2028     blue: Optional[int] = None,
2029     *,
2030     force_16color: bool = False,
2031     force_216color: bool = False,
2032 ) -> str:
2033     """Return the ANSI escape sequence to change the foreground color
2034     text is printed to the console with.  Target colors may be
2035     indicated either by name or R/G/B values.  Result will use the 16
2036     or 216 color scheme if force_16color or force_216color are passed
2037     (respectively).  Otherwise the code will do what it thinks best.
2038
2039     Args:
2040         name: the name of the color to set
2041         red: the color to set's red component value
2042         green: the color to set's green component value
2043         blue: the color to set's blue component value
2044         force_16color: force fg to use 16 color mode
2045         force_216color: force fg to use 216 color mode
2046
2047     Returns:
2048         String containing the ANSI escape sequence to set desired foreground
2049
2050     .. note::
2051
2052         16-color and 216-color spaces can't be used to represent all colors
2053         describable by 8 bit R, G and B channels (i.e. normal R/G/B hex values)
2054         If you set the force_16color or force_216color arguments but describe
2055         a color (by name or R/G/B) that can't be represented in the forced
2056         color space the code will pick the closest approximation available.
2057
2058     >>> import string_utils as su
2059     >>> su.to_base64(fg('blue'))
2060     b'G1szODs1OzIxbQ==\\n'
2061     """
2062     if name is not None and name == 'reset':
2063         return reset_fg()
2064
2065     if name is not None and string_utils.is_full_string(name):
2066         rgb = _find_color_by_name(name)
2067         return fg(
2068             None,
2069             rgb[0],
2070             rgb[1],
2071             rgb[2],
2072             force_16color=force_16color,
2073             force_216color=force_216color,
2074         )
2075
2076     if red is None:
2077         red = 0
2078     if green is None:
2079         green = 0
2080     if blue is None:
2081         blue = 0
2082     if (_is_16color(red) and _is_16color(green) and _is_16color(blue)) or force_16color:
2083         logger.debug("Using 16-color strategy")
2084         return fg_16color(red, green, blue)
2085     if (
2086         _is_216color(red) and _is_216color(green) and _is_216color(blue)
2087     ) or force_216color:
2088         logger.debug("Using 216-color strategy")
2089         return fg_216color(red, green, blue)
2090     logger.debug("Using 24-bit color strategy")
2091     return fg_24bit(red, green, blue)
2092
2093
2094 def reset_fg():
2095     """Returns: an ANSI escape code to reset just the foreground color
2096     while preserving the background color and any other formatting
2097     (bold, italics, etc...)
2098     """
2099     return '\033[39m'
2100
2101
2102 def _rgb_to_yiq(rgb: Tuple[int, int, int]) -> int:
2103     """Helper for contrasting pick_contrasting_color.  Maps an RGB
2104     color tuple in to YIQ space.  See: https://en.wikipedia.org/wiki/YIQ."""
2105     return (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) // 1000
2106
2107
2108 def _contrast(rgb: Tuple[int, int, int]) -> Tuple[int, int, int]:
2109     """Helper for contrasting pick_contrasting_color."""
2110     if _rgb_to_yiq(rgb) < 128:
2111         return (0xFF, 0xFF, 0xFF)
2112     return (0, 0, 0)
2113
2114
2115 def pick_contrasting_color(
2116     name: Optional[str] = "",
2117     red: Optional[int] = None,
2118     green: Optional[int] = None,
2119     blue: Optional[int] = None,
2120 ) -> Tuple[int, int, int]:
2121     """This method will return a red, green, blue tuple representing a
2122     contrasting color given the red, green, blue of a background
2123     color or a color name of the background color.  This is meant to
2124     help ensure text printed on this background color will be visible.
2125
2126     Args:
2127         name: the name of the color to contrast
2128         red: the color to contrast's red component value
2129         green: the color to contrast's green component value
2130         blue: the color to contrast's blue component value
2131
2132     Returns:
2133         An RGB tuple containing a contrasting color
2134
2135     >>> pick_contrasting_color(None, 20, 20, 20)
2136     (255, 255, 255)
2137
2138     >>> pick_contrasting_color("white")
2139     (0, 0, 0)
2140
2141     """
2142     if name is not None and string_utils.is_full_string(name):
2143         rgb = _find_color_by_name(name)
2144     else:
2145         r = red if red is not None else 0
2146         g = green if green is not None else 0
2147         b = blue if blue is not None else 0
2148         rgb = (r, g, b)
2149     assert rgb is not None
2150     return _contrast(rgb)
2151
2152
2153 def _guess_name(name: str) -> str:
2154     """Try to guess what color the user is talking about"""
2155     best_guess = None
2156     max_ratio = None
2157     for possibility in COLOR_NAMES_TO_RGB:
2158         r = difflib.SequenceMatcher(None, name, possibility).ratio()
2159         if max_ratio is None or r > max_ratio:
2160             max_ratio = r
2161             best_guess = possibility
2162     assert best_guess is not None
2163     logger.debug("Best guess at color name is %s", best_guess)
2164     return best_guess
2165
2166
2167 @logging_utils.squelch_repeated_log_messages(1)
2168 def bg(
2169     name: Optional[str] = "",
2170     red: Optional[int] = None,
2171     green: Optional[int] = None,
2172     blue: Optional[int] = None,
2173     *,
2174     force_16color: bool = False,
2175     force_216color: bool = False,
2176 ) -> str:
2177     """Returns an ANSI color code for changing the current text background
2178     color.
2179
2180     Args:
2181         name: the name of the color to set
2182         red: the color to set's red component value
2183         green: the color to set's green component value
2184         blue: the color to set's blue component value
2185         force_16color: force bg to use 16 color mode
2186         force_216color: force bg to use 216 color mode
2187
2188     Returns:
2189         A string containing the requested escape sequence
2190
2191     .. note::
2192
2193         16-color and 216-color spaces can't be used to represent all colors
2194         describable by 8 bit R, G and B channels (i.e. normal R/G/B hex values)
2195         If you set the force_16color or force_216color arguments but describe
2196         a color (by name or R/G/B) that can't be represented in the forced
2197         color space the code will pick the closest approximation available.
2198
2199     >>> import string_utils as su
2200     >>> su.to_base64(bg("red"))    # b'\x1b[48;5;196m'
2201     b'G1s0ODs1OzE5Nm0=\\n'
2202     """
2203     if name is not None and name == 'reset':
2204         return reset_bg()
2205
2206     if name is not None and string_utils.is_full_string(name):
2207         rgb = _find_color_by_name(name)
2208         return bg(
2209             None,
2210             rgb[0],
2211             rgb[1],
2212             rgb[2],
2213             force_16color=force_16color,
2214             force_216color=force_216color,
2215         )
2216     if red is None:
2217         red = 0
2218     if green is None:
2219         green = 0
2220     if blue is None:
2221         blue = 0
2222     if (_is_16color(red) and _is_16color(green) and _is_16color(blue)) or force_16color:
2223         logger.debug("Using 16-color strategy")
2224         return bg_16color(red, green, blue)
2225     if (
2226         _is_216color(red) and _is_216color(green) and _is_216color(blue)
2227     ) or force_216color:
2228         logger.debug("Using 216-color strategy")
2229         return bg_216color(red, green, blue)
2230     logger.debug("Using 24-bit color strategy")
2231     return bg_24bit(red, green, blue)
2232
2233
2234 def reset_bg():
2235     """Returns an ANSI escape sequence that resets text background
2236     color to the default but preserves foreground coloring and text
2237     attributes like bold, italics, underlines, etc...
2238     """
2239     return '\033[49m'
2240
2241
2242 class _StdoutInterceptor(io.TextIOBase, contextlib.AbstractContextManager):
2243     """An interceptor for data written to stdout.  Use as a context."""
2244
2245     def __init__(self):
2246         super().__init__()
2247         self.saved_stdout: io.TextIOWrapper = None
2248         self.buf = ''
2249
2250     @abstractmethod
2251     def write(self, s: str):
2252         pass
2253
2254     def __enter__(self):
2255         self.saved_stdout = sys.stdout
2256         sys.stdout = self
2257         return self
2258
2259     def __exit__(self, *args) -> None:
2260         sys.stdout = self.saved_stdout
2261         print(self.buf)
2262
2263
2264 class ProgrammableColorizer(_StdoutInterceptor):
2265     """A colorizing interceptor; pass it re.Patterns -> methods that
2266     do something (usually add color to) the match.  This may be useful
2267     for adding color to non-colorized text in a stream without
2268     changing the code that emits the text directly.  In the example
2269     doctest below I'm inserting [RED] and [RESET] strings but you
2270     could just as easily insert escape sequences returned from
2271     :py:meth:`fg`, :py:meth:`bg`, and :py:meth:`reset`.
2272
2273     >>> def red(match: re.Match) -> str:
2274     ...     return '[RED]'
2275
2276     >>> def reset(match: re.Match) -> str:
2277     ...     return '[RESET]'
2278
2279     >>> with ProgrammableColorizer( [ (re.compile('^[^ ]+'), red),
2280     ...                               (re.compile('$'), reset) ] ) as c:
2281     ...     c.write("This matches the pattern and will call red()")
2282     ...     c.write("     ...this won't")
2283     [RED] matches the pattern and will call red()[RESET]     ...this won't[RESET]
2284     """
2285
2286     def __init__(
2287         self,
2288         patterns: Iterable[Tuple[re.Pattern, Callable[[re.Match[str]], str]]],
2289     ):
2290         """
2291         Setup the programmable colorizing context; tell it how to operate.
2292
2293         Args:
2294             patterns: an iterable collection of tuples.  Each tuple has an
2295                 re.Pattern that describes the text pattern which
2296                 will trigger the colorization and a method to call when the
2297                 pattern is matched.  These methods receive the `re.MATCH`
2298                 object and usually just emit some ANSI escape sequence to
2299                 colorize the stream.  See the example above.
2300         """
2301         super().__init__()
2302         self.patterns = list(patterns)
2303
2304     @overrides
2305     def write(self, s: str):
2306         """Use this method to feed the stream of text through the colorizer.
2307         See the example above.
2308
2309         Args:
2310             s: A line from the stream to colorize.
2311         """
2312         for pattern in self.patterns:
2313             s = pattern[0].sub(pattern[1], s)
2314         self.buf += s
2315
2316
2317 if __name__ == '__main__':
2318
2319     def main() -> None:
2320         import doctest
2321
2322         doctest.testmod()
2323
2324         name = " ".join(sys.argv[1:])
2325         for possibility in COLOR_NAMES_TO_RGB:
2326             if name in possibility:
2327                 f = fg(possibility)
2328                 b = bg(possibility)
2329                 _ = pick_contrasting_color(possibility)
2330                 xf = fg(None, _[0], _[1], _[2])
2331                 xb = bg(None, _[0], _[1], _[2])
2332                 print(
2333                     f'{f}{xb}{possibility:<40}{reset()}'
2334                     f'{b}{xf}{possibility:<40}{reset()}'
2335                 )
2336
2337     main()