forked from xonsh/xonsh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ansi_colors.py
1165 lines (1059 loc) · 32.3 KB
/
ansi_colors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""Tools for helping with ANSI color codes."""
import re
import sys
import warnings
from xonsh.built_ins import XSH
from xonsh.color_tools import (
BASE_XONSH_COLORS,
RE_XONSH_COLOR,
find_closest_color,
iscolor,
make_palette,
rgb2short,
rgb_to_256,
short_to_ints,
warn_deprecated_no_color,
)
from xonsh.lazyasd import LazyDict, lazyobject
from xonsh.platform import HAS_PYGMENTS
from xonsh.tools import FORMATTER
# pygments modifier to ANSI escape code mapping
_PART_STYLE_CODE_MAPPING = {
"bold": "1",
"nobold": "21",
"italic": "3",
"noitalic": "23",
"underline": "4",
"nounderline": "24",
"blink": "5",
"noblink": "25",
"reverse": "7",
"noreverse": "27",
"hidden": "8",
"nohidden": "28",
}
def _ensure_color_map(style="default", cmap=None):
if cmap is not None:
pass
elif style in ANSI_STYLES:
cmap = ANSI_STYLES[style]
else:
try: # dynamically loading the style
cmap = ansi_style_by_name(style)
except Exception:
msg = "Could not find color style {0!r}, using default."
print(msg.format(style), file=sys.stderr)
XSH.env["XONSH_COLOR_STYLE"] = "default"
cmap = ANSI_STYLES["default"]
return cmap
@lazyobject
def ANSI_ESCAPE_MODIFIERS():
return {
"BOLD": "1",
"FAINT": "2",
"ITALIC": "3",
"UNDERLINE": "4",
"SLOWBLINK": "5",
"FASTBLINK": "6",
"INVERT": "7",
"CONCEAL": "8",
"STRIKETHROUGH": "9",
"BOLDOFF": "21",
"FAINTOFF": "22",
"ITALICOFF": "23",
"UNDERLINEOFF": "24",
"BLINKOFF": "25",
"INVERTOFF": "27",
"REVEALOFF": "28",
"STRIKETHROUGHOFF": "29",
}
def ansi_color_name_to_escape_code(name, style="default", cmap=None):
"""Converts a color name to the inner part of an ANSI escape code"""
cmap = _ensure_color_map(style=style, cmap=cmap)
if name in cmap:
return cmap[name]
m = RE_XONSH_COLOR.match(name)
if m is None:
raise ValueError(f"{name!r} is not a color!")
parts = m.groupdict()
# convert regex match into actual ANSI colors
if parts["reset"] is not None:
if parts["reset"] == "NO_COLOR":
warn_deprecated_no_color()
res = "0"
elif parts["bghex"] is not None:
res = "48;5;" + rgb_to_256(parts["bghex"][3:])[0]
elif parts["background"] is not None:
color = parts["color"]
if "#" in color:
res = "48;5;" + rgb_to_256(color[1:])[0]
else:
fgcolor = cmap[color]
if fgcolor.isdecimal():
res = str(int(fgcolor) + 10)
elif fgcolor.startswith("38;"):
res = "4" + fgcolor[1:]
elif fgcolor == "DEFAULT":
res = "39"
else:
msg = (
"when converting {!r}, did not recognize {!r} within "
"the following color map as a valid color:\n\n{!r}"
)
raise ValueError(msg.format(name, fgcolor, cmap))
else:
# have regular, non-background color
mods = parts["modifiers"]
if mods is None:
mods = []
else:
mods = mods.strip("_").split("_")
mods = [ANSI_ESCAPE_MODIFIERS[mod] for mod in mods]
color = parts["color"]
if "#" in color:
mods.append("38;5;" + rgb_to_256(color[1:])[0])
elif color == "DEFAULT":
res = "39"
else:
mods.append(cmap[color])
res = ";".join(mods)
cmap[name] = res
return res
def ansi_partial_color_format(template, style="default", cmap=None, hide=False):
"""Formats a template string but only with respect to the colors.
Another template string is returned, with the color values filled in.
Parameters
----------
template : str
The template string, potentially with color names.
style : str, optional
Style name to look up color map from.
cmap : dict, optional
A color map to use, this will prevent the color map from being
looked up via the style name.
hide : bool, optional
Whether to wrap the color codes in the \\001 and \\002 escape
codes, so that the color codes are not counted against line
length.
Returns
-------
A template string with the color values filled in.
"""
try:
return _ansi_partial_color_format_main(
template, style=style, cmap=cmap, hide=hide
)
except Exception:
return template
def _ansi_partial_color_format_main(template, style="default", cmap=None, hide=False):
cmap = _ensure_color_map(style=style, cmap=cmap)
overrides = XSH.env["XONSH_STYLE_OVERRIDES"]
if overrides:
cmap.update(_style_dict_to_ansi(overrides))
esc = ("\001" if hide else "") + "\033["
m = "m" + ("\002" if hide else "")
bopen = "{"
bclose = "}"
colon = ":"
expl = "!"
toks = []
for literal, field, spec, conv in FORMATTER.parse(template):
toks.append(literal)
if field is None:
pass
elif field in cmap:
toks.extend([esc, cmap[field], m])
elif iscolor(field):
color = ansi_color_name_to_escape_code(field, cmap=cmap)
cmap[field] = color
toks.extend([esc, color, m])
elif field is not None:
toks.append(bopen)
toks.append(field)
if conv is not None and len(conv) > 0:
toks.append(expl)
toks.append(conv)
if spec is not None and len(spec) > 0:
toks.append(colon)
toks.append(spec)
toks.append(bclose)
return "".join(toks)
def ansi_color_style_names():
"""Returns an iterable of all ANSI color style names."""
return ANSI_STYLES.keys()
def ansi_color_style(style="default"):
"""Returns the current color map."""
if style in ANSI_STYLES:
cmap = ANSI_STYLES[style]
else:
msg = f"Could not find color style {style!r}, using default."
warnings.warn(msg, RuntimeWarning)
cmap = ANSI_STYLES["default"]
return cmap
def ansi_reverse_style(style="default", return_style=False):
"""Reverses an ANSI color style mapping so that escape codes map to
colors. Style may either be string or mapping. May also return
the style it looked up.
"""
style = ansi_style_by_name(style) if isinstance(style, str) else style
reversed_style = {v: k for k, v in style.items()}
# add keys to make this more useful
updates = {
"1": "BOLD_",
"2": "FAINT_",
"3": "ITALIC_",
"4": "UNDERLINE_",
"5": "SLOWBLINK_",
"6": "FASTBLINK_",
"7": "INVERT_",
"8": "CONCEAL_",
"9": "STRIKETHROUGH_",
"21": "BOLDOFF_",
"22": "FAINTOFF_",
"23": "ITALICOFF_",
"24": "UNDERLINEOFF_",
"25": "BLINKOFF_",
"27": "INVERTOFF_",
"28": "REVEALOFF_",
"29": "STRIKETHROUGHOFF_",
"38": "SET_FOREGROUND_",
"48": "SET_BACKGROUND_",
"38;2": "SET_FOREGROUND_FAINT_",
"48;2": "SET_BACKGROUND_FAINT_",
"38;5": "SET_FOREGROUND_SLOWBLINK_",
"48;5": "SET_BACKGROUND_SLOWBLINK_",
}
for ec, name in reversed_style.items():
no_left_zero = ec.lstrip("0")
if no_left_zero.startswith(";"):
updates[no_left_zero[1:]] = name
elif no_left_zero != ec:
updates[no_left_zero] = name
reversed_style.update(updates)
# return results
if return_style:
return style, reversed_style
else:
return reversed_style
@lazyobject
def ANSI_ESCAPE_CODE_RE():
return re.compile(r"\001?(\033\[)?([0-9;]+)m?\002?")
@lazyobject
def ANSI_COLOR_NAME_SET_3INTS_RE():
return re.compile(r"(\w+_)?SET_(FORE|BACK)GROUND_FAINT_(\d+)_(\d+)_(\d+)")
@lazyobject
def ANSI_COLOR_NAME_SET_SHORT_RE():
return re.compile(r"(\w+_)?SET_(FORE|BACK)GROUND_SLOWBLINK_(\d+)")
def _color_name_from_ints(ints, background=False, prefix=None):
name = find_closest_color(ints, BASE_XONSH_COLORS)
if background:
name = "BACKGROUND_" + name
name = name if prefix is None else prefix + name
return name
def ansi_color_escape_code_to_name(escape_code, style, reversed_style=None):
"""Converts an ANSI color code escape sequence to a tuple of color names
in the provided style ('default' should almost be the style). For example,
'0' becomes ('RESET',) and '32;41' becomes ('GREEN', 'BACKGROUND_RED').
The style keyword may either be a string, in which the style is looked up,
or an actual style dict. You can also provide a reversed style mapping,
too, which is just the keys/values of the style dict swapped. If reversed
style is not provided, it is computed.
"""
if reversed_style is None:
style, reversed_style = ansi_reverse_style(style, return_style=True)
# strip some actual escape codes, if needed.
match = ANSI_ESCAPE_CODE_RE.match(escape_code)
if not match:
msg = 'Invalid ANSI color sequence "{}", using "RESET" instead.'.format(
escape_code
)
warnings.warn(msg, RuntimeWarning)
return ("RESET",)
ec = match.group(2)
names = []
n_ints = 0
seen_set_foreback = False
for e in ec.split(";"):
no_left_zero = e.lstrip("0") if len(e) > 1 else e
if seen_set_foreback and n_ints > 0:
names.append(e)
n_ints -= 1
if n_ints == 0:
seen_set_foreback = False
continue
else:
names.append(reversed_style.get(no_left_zero, no_left_zero))
# set the flags for next time
if "38" == e or "48" == e:
seen_set_foreback = True
elif seen_set_foreback and "2" == e:
n_ints = 3
elif seen_set_foreback and "5" == e:
n_ints = 1
# normalize names
n = ""
norm_names = []
prefixes = ""
for name in names:
if name in ("RESET", "NO_COLOR"):
# skip most '0' entries
continue
elif "BACKGROUND_" in name and n:
prefixes += n
n = ""
n = n + name if n else name
if n.endswith("_"):
continue
elif ANSI_COLOR_NAME_SET_SHORT_RE.match(n) is not None:
pre, fore_back, short = ANSI_COLOR_NAME_SET_SHORT_RE.match(n).groups()
n = _color_name_from_ints(
short_to_ints(short), background=(fore_back == "BACK"), prefix=pre
)
elif ANSI_COLOR_NAME_SET_3INTS_RE.match(n) is not None:
pre, fore_back, r, g, b = ANSI_COLOR_NAME_SET_3INTS_RE.match(n).groups()
n = _color_name_from_ints(
(int(r), int(g), int(b)), background=(fore_back == "BACK"), prefix=pre
)
elif "GROUND_FAINT_" in n:
# have 1 or 2, but not 3 ints
n += "_"
continue
# error check
if not iscolor(n):
msg = (
"Could not translate ANSI color code {escape_code!r} "
"into a known color in the palette. Specifically, the {n!r} "
"portion of {name!r} in {names!r} seems to missing."
)
raise ValueError(
msg.format(escape_code=escape_code, names=names, name=name, n=n)
)
norm_names.append(n)
n = ""
# check if we have pre- & post-fixes to apply to the last, non-background element
prefixes += n
if prefixes.endswith("_"):
for i in range(-1, -len(norm_names) - 1, -1):
if "BACKGROUND_" not in norm_names[i]:
norm_names[i] = prefixes + norm_names[i]
break
else:
# only have background colors, so select WHITE as default color
norm_names.append(prefixes + "WHITE")
# return
if len(norm_names) == 0:
return ("RESET",)
else:
return tuple(norm_names)
def _bw_style():
style = {
"RESET": "0",
"BLACK": "0;30",
"BLUE": "0;37",
"CYAN": "0;37",
"GREEN": "0;37",
"PURPLE": "0;37",
"RED": "0;37",
"WHITE": "0;37",
"YELLOW": "0;37",
"BACKGROUND_BLACK": "40",
"BACKGROUND_RED": "47",
"BACKGROUND_GREEN": "47",
"BACKGROUND_YELLOW": "47",
"BACKGROUND_BLUE": "47",
"BACKGROUND_PURPLE": "47",
"BACKGROUND_CYAN": "47",
"BACKGROUND_WHITE": "47",
"INTENSE_BLACK": "0;90",
"INTENSE_BLUE": "0;97",
"INTENSE_CYAN": "0;97",
"INTENSE_GREEN": "0;97",
"INTENSE_PURPLE": "0;97",
"INTENSE_RED": "0;97",
"INTENSE_WHITE": "0;97",
"INTENSE_YELLOW": "0;97",
}
return style
def _default_style():
style = {
# Reset
"RESET": "0", # Text Reset
# Regular Colors
"BLACK": "30", # BLACK
"RED": "31", # RED
"GREEN": "32", # GREEN
"YELLOW": "33", # YELLOW
"BLUE": "34", # BLUE
"PURPLE": "35", # PURPLE
"CYAN": "36", # CYAN
"WHITE": "37", # WHITE
# Background
"BACKGROUND_BLACK": "40", # BLACK
"BACKGROUND_RED": "41", # RED
"BACKGROUND_GREEN": "42", # GREEN
"BACKGROUND_YELLOW": "43", # YELLOW
"BACKGROUND_BLUE": "44", # BLUE
"BACKGROUND_PURPLE": "45", # PURPLE
"BACKGROUND_CYAN": "46", # CYAN
"BACKGROUND_WHITE": "47", # WHITE
# High Intensity
"INTENSE_BLACK": "90", # BLACK
"INTENSE_RED": "91", # RED
"INTENSE_GREEN": "92", # GREEN
"INTENSE_YELLOW": "93", # YELLOW
"INTENSE_BLUE": "94", # BLUE
"INTENSE_PURPLE": "95", # PURPLE
"INTENSE_CYAN": "96", # CYAN
"INTENSE_WHITE": "97", # WHITE
# High Intensity backgrounds
"BACKGROUND_INTENSE_BLACK": "100", # BLACK
"BACKGROUND_INTENSE_RED": "101", # RED
"BACKGROUND_INTENSE_GREEN": "102", # GREEN
"BACKGROUND_INTENSE_YELLOW": "103", # YELLOW
"BACKGROUND_INTENSE_BLUE": "104", # BLUE
"BACKGROUND_INTENSE_PURPLE": "105", # PURPLE
"BACKGROUND_INTENSE_CYAN": "106", # CYAN
"BACKGROUND_INTENSE_WHITE": "107", # WHITE
}
return style
def _monokai_style():
style = {
"RESET": "0",
"BLACK": "38;5;16",
"BLUE": "38;5;63",
"CYAN": "38;5;81",
"GREEN": "38;5;40",
"PURPLE": "38;5;89",
"RED": "38;5;124",
"WHITE": "38;5;188",
"YELLOW": "38;5;184",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;20",
"INTENSE_CYAN": "38;5;44",
"INTENSE_GREEN": "38;5;148",
"INTENSE_PURPLE": "38;5;141",
"INTENSE_RED": "38;5;197",
"INTENSE_WHITE": "38;5;15",
"INTENSE_YELLOW": "38;5;186",
}
return style
####################################
# Auto-generated below this line #
####################################
def _algol_style():
style = {
"BLACK": "38;5;59",
"BLUE": "38;5;59",
"CYAN": "38;5;59",
"GREEN": "38;5;59",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;102",
"INTENSE_CYAN": "38;5;102",
"INTENSE_GREEN": "38;5;102",
"INTENSE_PURPLE": "38;5;102",
"INTENSE_RED": "38;5;09",
"INTENSE_WHITE": "38;5;102",
"INTENSE_YELLOW": "38;5;102",
"RESET": "0",
"PURPLE": "38;5;59",
"RED": "38;5;09",
"WHITE": "38;5;102",
"YELLOW": "38;5;09",
}
return style
def _algol_nu_style():
style = {
"BLACK": "38;5;59",
"BLUE": "38;5;59",
"CYAN": "38;5;59",
"GREEN": "38;5;59",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;102",
"INTENSE_CYAN": "38;5;102",
"INTENSE_GREEN": "38;5;102",
"INTENSE_PURPLE": "38;5;102",
"INTENSE_RED": "38;5;09",
"INTENSE_WHITE": "38;5;102",
"INTENSE_YELLOW": "38;5;102",
"RESET": "0",
"PURPLE": "38;5;59",
"RED": "38;5;09",
"WHITE": "38;5;102",
"YELLOW": "38;5;09",
}
return style
def _autumn_style():
style = {
"BLACK": "38;5;18",
"BLUE": "38;5;19",
"CYAN": "38;5;37",
"GREEN": "38;5;34",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;33",
"INTENSE_CYAN": "38;5;33",
"INTENSE_GREEN": "38;5;64",
"INTENSE_PURPLE": "38;5;217",
"INTENSE_RED": "38;5;130",
"INTENSE_WHITE": "38;5;145",
"INTENSE_YELLOW": "38;5;217",
"RESET": "0",
"PURPLE": "38;5;90",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;130",
}
return style
def _borland_style():
style = {
"BLACK": "38;5;16",
"BLUE": "38;5;18",
"CYAN": "38;5;30",
"GREEN": "38;5;28",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;21",
"INTENSE_CYAN": "38;5;194",
"INTENSE_GREEN": "38;5;102",
"INTENSE_PURPLE": "38;5;188",
"INTENSE_RED": "38;5;09",
"INTENSE_WHITE": "38;5;224",
"INTENSE_YELLOW": "38;5;188",
"RESET": "0",
"PURPLE": "38;5;90",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;124",
}
return style
def _colorful_style():
style = {
"BLACK": "38;5;16",
"BLUE": "38;5;20",
"CYAN": "38;5;31",
"GREEN": "38;5;34",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;61",
"INTENSE_CYAN": "38;5;145",
"INTENSE_GREEN": "38;5;102",
"INTENSE_PURPLE": "38;5;217",
"INTENSE_RED": "38;5;166",
"INTENSE_WHITE": "38;5;15",
"INTENSE_YELLOW": "38;5;217",
"RESET": "0",
"PURPLE": "38;5;90",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;130",
}
return style
def _emacs_style():
style = {
"BLACK": "38;5;28",
"BLUE": "38;5;18",
"CYAN": "38;5;26",
"GREEN": "38;5;34",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;26",
"INTENSE_CYAN": "38;5;145",
"INTENSE_GREEN": "38;5;34",
"INTENSE_PURPLE": "38;5;129",
"INTENSE_RED": "38;5;167",
"INTENSE_WHITE": "38;5;145",
"INTENSE_YELLOW": "38;5;145",
"RESET": "0",
"PURPLE": "38;5;90",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;130",
}
return style
def _friendly_style():
style = {
"BLACK": "38;5;22",
"BLUE": "38;5;18",
"CYAN": "38;5;31",
"GREEN": "38;5;34",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;74",
"INTENSE_CYAN": "38;5;74",
"INTENSE_GREEN": "38;5;71",
"INTENSE_PURPLE": "38;5;134",
"INTENSE_RED": "38;5;167",
"INTENSE_WHITE": "38;5;15",
"INTENSE_YELLOW": "38;5;145",
"RESET": "0",
"PURPLE": "38;5;90",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;166",
}
return style
def _fruity_style():
style = {
"BLACK": "38;5;16",
"BLUE": "38;5;32",
"CYAN": "38;5;32",
"GREEN": "38;5;28",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;33",
"INTENSE_CYAN": "38;5;33",
"INTENSE_GREEN": "38;5;102",
"INTENSE_PURPLE": "38;5;198",
"INTENSE_RED": "38;5;202",
"INTENSE_WHITE": "38;5;15",
"INTENSE_YELLOW": "38;5;187",
"RESET": "0",
"PURPLE": "38;5;198",
"RED": "38;5;09",
"WHITE": "38;5;187",
"YELLOW": "38;5;202",
}
return style
def _igor_style():
style = {
"BLACK": "38;5;34",
"BLUE": "38;5;21",
"CYAN": "38;5;30",
"GREEN": "38;5;34",
"INTENSE_BLACK": "38;5;30",
"INTENSE_BLUE": "38;5;21",
"INTENSE_CYAN": "38;5;30",
"INTENSE_GREEN": "38;5;34",
"INTENSE_PURPLE": "38;5;163",
"INTENSE_RED": "38;5;166",
"INTENSE_WHITE": "38;5;163",
"INTENSE_YELLOW": "38;5;166",
"RESET": "0",
"PURPLE": "38;5;163",
"RED": "38;5;166",
"WHITE": "38;5;163",
"YELLOW": "38;5;166",
}
return style
def _lovelace_style():
style = {
"BLACK": "38;5;59",
"BLUE": "38;5;25",
"CYAN": "38;5;29",
"GREEN": "38;5;65",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;25",
"INTENSE_CYAN": "38;5;102",
"INTENSE_GREEN": "38;5;29",
"INTENSE_PURPLE": "38;5;133",
"INTENSE_RED": "38;5;131",
"INTENSE_WHITE": "38;5;102",
"INTENSE_YELLOW": "38;5;136",
"RESET": "0",
"PURPLE": "38;5;133",
"RED": "38;5;124",
"WHITE": "38;5;102",
"YELLOW": "38;5;130",
}
return style
def _manni_style():
style = {
"BLACK": "38;5;16",
"BLUE": "38;5;18",
"CYAN": "38;5;30",
"GREEN": "38;5;40",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;105",
"INTENSE_CYAN": "38;5;45",
"INTENSE_GREEN": "38;5;113",
"INTENSE_PURPLE": "38;5;165",
"INTENSE_RED": "38;5;202",
"INTENSE_WHITE": "38;5;224",
"INTENSE_YELLOW": "38;5;221",
"RESET": "0",
"PURPLE": "38;5;165",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;166",
}
return style
def _murphy_style():
style = {
"BLACK": "38;5;16",
"BLUE": "38;5;18",
"CYAN": "38;5;31",
"GREEN": "38;5;34",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;63",
"INTENSE_CYAN": "38;5;86",
"INTENSE_GREEN": "38;5;86",
"INTENSE_PURPLE": "38;5;213",
"INTENSE_RED": "38;5;209",
"INTENSE_WHITE": "38;5;15",
"INTENSE_YELLOW": "38;5;222",
"RESET": "0",
"PURPLE": "38;5;90",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;166",
}
return style
def _native_style():
style = {
"BLACK": "38;5;52",
"BLUE": "38;5;67",
"CYAN": "38;5;31",
"GREEN": "38;5;64",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;68",
"INTENSE_CYAN": "38;5;87",
"INTENSE_GREEN": "38;5;70",
"INTENSE_PURPLE": "38;5;188",
"INTENSE_RED": "38;5;160",
"INTENSE_WHITE": "38;5;15",
"INTENSE_YELLOW": "38;5;214",
"RESET": "0",
"PURPLE": "38;5;59",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;124",
}
return style
def _paraiso_dark_style():
style = {
"BLACK": "38;5;95",
"BLUE": "38;5;97",
"CYAN": "38;5;39",
"GREEN": "38;5;72",
"INTENSE_BLACK": "38;5;95",
"INTENSE_BLUE": "38;5;97",
"INTENSE_CYAN": "38;5;79",
"INTENSE_GREEN": "38;5;72",
"INTENSE_PURPLE": "38;5;188",
"INTENSE_RED": "38;5;203",
"INTENSE_WHITE": "38;5;188",
"INTENSE_YELLOW": "38;5;220",
"RESET": "0",
"PURPLE": "38;5;97",
"RED": "38;5;203",
"WHITE": "38;5;79",
"YELLOW": "38;5;214",
}
return style
def _paraiso_light_style():
style = {
"BLACK": "38;5;16",
"BLUE": "38;5;16",
"CYAN": "38;5;39",
"GREEN": "38;5;72",
"INTENSE_BLACK": "38;5;16",
"INTENSE_BLUE": "38;5;97",
"INTENSE_CYAN": "38;5;79",
"INTENSE_GREEN": "38;5;72",
"INTENSE_PURPLE": "38;5;97",
"INTENSE_RED": "38;5;203",
"INTENSE_WHITE": "38;5;79",
"INTENSE_YELLOW": "38;5;220",
"RESET": "0",
"PURPLE": "38;5;97",
"RED": "38;5;16",
"WHITE": "38;5;102",
"YELLOW": "38;5;214",
}
return style
def _pastie_style():
style = {
"BLACK": "38;5;16",
"BLUE": "38;5;20",
"CYAN": "38;5;25",
"GREEN": "38;5;28",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;61",
"INTENSE_CYAN": "38;5;194",
"INTENSE_GREEN": "38;5;34",
"INTENSE_PURPLE": "38;5;188",
"INTENSE_RED": "38;5;172",
"INTENSE_WHITE": "38;5;15",
"INTENSE_YELLOW": "38;5;188",
"RESET": "0",
"PURPLE": "38;5;125",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;130",
}
return style
def _perldoc_style():
style = {
"BLACK": "38;5;18",
"BLUE": "38;5;18",
"CYAN": "38;5;31",
"GREEN": "38;5;34",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;134",
"INTENSE_CYAN": "38;5;145",
"INTENSE_GREEN": "38;5;28",
"INTENSE_PURPLE": "38;5;134",
"INTENSE_RED": "38;5;167",
"INTENSE_WHITE": "38;5;188",
"INTENSE_YELLOW": "38;5;188",
"RESET": "0",
"PURPLE": "38;5;90",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;166",
}
return style
def _rrt_style():
style = {
"BLACK": "38;5;09",
"BLUE": "38;5;117",
"CYAN": "38;5;117",
"GREEN": "38;5;46",
"INTENSE_BLACK": "38;5;117",
"INTENSE_BLUE": "38;5;117",
"INTENSE_CYAN": "38;5;122",
"INTENSE_GREEN": "38;5;46",
"INTENSE_PURPLE": "38;5;213",
"INTENSE_RED": "38;5;09",
"INTENSE_WHITE": "38;5;188",
"INTENSE_YELLOW": "38;5;222",
"RESET": "0",
"PURPLE": "38;5;213",
"RED": "38;5;09",
"WHITE": "38;5;117",
"YELLOW": "38;5;09",
}
return style
def _tango_style():
style = {
"BLACK": "38;5;16",
"BLUE": "38;5;20",
"CYAN": "38;5;61",
"GREEN": "38;5;34",
"INTENSE_BLACK": "38;5;24",
"INTENSE_BLUE": "38;5;62",
"INTENSE_CYAN": "38;5;15",
"INTENSE_GREEN": "38;5;64",
"INTENSE_PURPLE": "38;5;15",
"INTENSE_RED": "38;5;09",
"INTENSE_WHITE": "38;5;15",
"INTENSE_YELLOW": "38;5;178",
"RESET": "0",
"PURPLE": "38;5;90",
"RED": "38;5;124",
"WHITE": "38;5;15",
"YELLOW": "38;5;94",
}
return style
def _trac_style():
style = {
"BLACK": "38;5;16",
"BLUE": "38;5;18",
"CYAN": "38;5;30",
"GREEN": "38;5;100",
"INTENSE_BLACK": "38;5;59",
"INTENSE_BLUE": "38;5;60",
"INTENSE_CYAN": "38;5;194",
"INTENSE_GREEN": "38;5;102",
"INTENSE_PURPLE": "38;5;188",
"INTENSE_RED": "38;5;137",
"INTENSE_WHITE": "38;5;224",
"INTENSE_YELLOW": "38;5;188",
"RESET": "0",
"PURPLE": "38;5;90",
"RED": "38;5;124",
"WHITE": "38;5;145",
"YELLOW": "38;5;100",
}
return style
def _vim_style():
style = {
"BLACK": "38;5;18",
"BLUE": "38;5;18",
"CYAN": "38;5;44",
"GREEN": "38;5;40",
"INTENSE_BLACK": "38;5;60",
"INTENSE_BLUE": "38;5;68",
"INTENSE_CYAN": "38;5;44",
"INTENSE_GREEN": "38;5;40",
"INTENSE_PURPLE": "38;5;164",
"INTENSE_RED": "38;5;09",
"INTENSE_WHITE": "38;5;188",
"INTENSE_YELLOW": "38;5;184",
"RESET": "0",
"PURPLE": "38;5;164",
"RED": "38;5;160",
"WHITE": "38;5;188",
"YELLOW": "38;5;160",
}
return style
def _vs_style():
style = {
"BLACK": "38;5;28",
"BLUE": "38;5;21",
"CYAN": "38;5;31",
"GREEN": "38;5;28",
"INTENSE_BLACK": "38;5;31",
"INTENSE_BLUE": "38;5;31",
"INTENSE_CYAN": "38;5;31",
"INTENSE_GREEN": "38;5;31",
"INTENSE_PURPLE": "38;5;31",
"INTENSE_RED": "38;5;09",
"INTENSE_WHITE": "38;5;31",
"INTENSE_YELLOW": "38;5;31",
"RESET": "0",
"PURPLE": "38;5;124",
"RED": "38;5;124",
"WHITE": "38;5;31",
"YELLOW": "38;5;124",
}
return style
def _xcode_style():
style = {
"BLACK": "38;5;16",
"BLUE": "38;5;20",
"CYAN": "38;5;60",
"GREEN": "38;5;28",
"INTENSE_BLACK": "38;5;60",
"INTENSE_BLUE": "38;5;20",
"INTENSE_CYAN": "38;5;60",
"INTENSE_GREEN": "38;5;60",
"INTENSE_PURPLE": "38;5;126",
"INTENSE_RED": "38;5;160",