Skip to content

Commit e2c8837

Browse files
committed
Replace color definitions with colorama constants
1 parent bac254c commit e2c8837

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

tools/colorize.py

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,30 @@
2020

2121
import sys
2222
import re
23-
from colorama import init
23+
from colorama import init, Fore, Back, Style
2424
init()
2525

2626
colors = {
2727
'none' : "",
28-
'default' : "\033[.0m",
29-
'bold' : "\033[.1m",
30-
'underline' : "\033[.4m",
31-
'blink' : "\033[.5m",
32-
'reverse' : "\033[.7m",
33-
'concealed' : "\033[.8m",
28+
'default' : Style.RESET_ALL,
3429

35-
'black' : "\033[.30m",
36-
'red' : "\033[.31m",
37-
'green' : "\033[.32m",
38-
'yellow' : "\033[.33m",
39-
'blue' : "\033[.34m",
40-
'magenta' : "\033[.35m",
41-
'cyan' : "\033[.36m",
42-
'white' : "\033[.37m",
30+
'black' : Fore.BLACK,
31+
'red' : Fore.RED,
32+
'green' : Fore.GREEN,
33+
'yellow' : Fore.YELLOW,
34+
'blue' : Fore.BLUE,
35+
'magenta' : Fore.MAGENTA,
36+
'cyan' : Fore.CYAN,
37+
'white' : Fore.WHITE,
4338

44-
'on_black' : "\033[.40m",
45-
'on_red' : "\033[.41m",
46-
'on_green' : "\033[.42m",
47-
'on_yellow' : "\033[.43m",
48-
'on_blue' : "\033[.44m",
49-
'on_magenta' : "\033[.45m",
50-
'on_cyan' : "\033[46m",
51-
'on_white' : "\033[47m",
39+
'on_black' : Back.BLACK,
40+
'on_red' : Back.RED,
41+
'on_green' : Back.GREEN,
42+
'on_yellow' : Back.YELLOW,
43+
'on_blue' : Back.BLUE,
44+
'on_magenta' : Back.MAGENTA,
45+
'on_cyan' : Back.CYAN,
46+
'on_white' : Back.WHITE,
5247
}
5348

5449
# Convert a color string from a string into an ascii escape code that will print

0 commit comments

Comments
 (0)