-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.py
87 lines (51 loc) · 1.29 KB
/
utils.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
from termcolor import colored
def green(text):
return colored(text, 'green')
def red(text):
return colored(text, 'red')
def yellow(text):
return colored(text, 'yellow')
def blue(text):
return colored(text, 'blue')
def cyan(text):
return colored(text, 'cyan')
def magenta(text):
return colored(text, 'magenta')
def light_red(text):
return colored(text, 'light_red')
def light_green(text):
return colored(text, 'light_green')
def light_yellow(text):
return colored(text, 'light_yellow')
def light_blue(text):
return colored(text, 'light_blue')
def light_magenta(text):
return colored(text, 'light_magenta')
def light_cyan(text):
return colored(text, 'light_cyan')
def grey(text):
return colored(text, 'grey')
def on_green(text):
return colored(text, on_color='on_green')
def on_red(text):
return colored(text, on_color='on_red')
def on_yellow(text):
return colored(text, on_color='on_yellow')
color_palette = {
0: green,
1: red,
2: yellow,
3: blue,
4: magenta,
5: cyan,
6: light_red,
7: light_green,
8: light_yellow,
9: light_blue,
10: light_magenta,
11: light_cyan,
12: grey,
13: on_green
}
def colorize(text, color: int):
return color_palette[color](text)