]>
jfr.im git - dlqueue.git/blob - venv/lib/python3.11/site-packages/pip/_vendor/pygments/console.py
5 Format colored console output.
7 :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
8 :license: BSD, see LICENSE for details.
15 codes
["reset"] = esc
+ "39;49;00m"
17 codes
["bold"] = esc
+ "01m"
18 codes
["faint"] = esc
+ "02m"
19 codes
["standout"] = esc
+ "03m"
20 codes
["underline"] = esc
+ "04m"
21 codes
["blink"] = esc
+ "05m"
22 codes
["overline"] = esc
+ "06m"
24 dark_colors
= ["black", "red", "green", "yellow", "blue",
25 "magenta", "cyan", "gray"]
26 light_colors
= ["brightblack", "brightred", "brightgreen", "brightyellow", "brightblue",
27 "brightmagenta", "brightcyan", "white"]
30 for d
, l
in zip(dark_colors
, light_colors
):
31 codes
[d
] = esc
+ "%im" % x
32 codes
[l
] = esc
+ "%im" % (60 + x
)
37 codes
["white"] = codes
["bold"]
44 def colorize(color_key
, text
):
45 return codes
[color_key
] + text
+ codes
["reset"]
48 def ansiformat(attr
, text
):
50 Format ``text`` with a color and/or some attributes::
54 _color_ underlined color
55 +color+ blinking color
58 if attr
[:1] == attr
[-1:] == '+':
59 result
.append(codes
['blink'])
61 if attr
[:1] == attr
[-1:] == '*':
62 result
.append(codes
['bold'])
64 if attr
[:1] == attr
[-1:] == '_':
65 result
.append(codes
['underline'])
67 result
.append(codes
[attr
])
69 result
.append(codes
['reset'])
70 return ''.join(result
)