-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor.py
31 lines (24 loc) · 879 Bytes
/
color.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
'''
Module used to define colors for logging messages and plot-backgrounds.
It contains:
colors: colornames with corresponding terminal code
Style: lamdas to color any string outside of logger
C.Siegenthaler 2020 (C2SM)
J.Jucker 12.2020 (C2SM)
'''
colors = {
'black': "\033[30m",
'green': "\033[32m",
'orange': "\033[33m",
'red': "\x1b[31;21m",
'bold_red': "\x1b[31;1m",
'red_highl': "\u001b[41m",
'reset': "\x1b[0m"
}
class Style():
BLACK = lambda x: colors['black'] + str(x) + colors['reset']
GREEN = lambda x: colors['green'] + str(x) + colors['reset']
ORANGE = lambda x: colors['orange'] + str(x) + colors['reset']
RED = lambda x: colors['red'] + str(x) + colors['reset']
BOLD_RED = lambda x: colors['bold_red'] + str(x) + colors['reset']
RED_HIGHL = lambda x: colors['red_highl'] + str(x) + colors['reset']