-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle.py
27 lines (21 loc) · 913 Bytes
/
style.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
color_none = '\x1b[0m'
color_grey = '\x1b[1;90m'
color_red = '\x1b[1;91m'
color_green = '\x1b[1;92m'
color_purple = '\x1b[1;95m'
color_cyan = '\x1b[1;96m'
cs_box_head = '┬ ┬'
cs_box_tail = '┴ ┴'
ap_box_head = '┬ ┬ ┬ ┬'
ap_box_tail = '┴ ┴ ┴ ┴'
# Runtime messages
def print_message(s: str, icon = '+', icon_color = color_green):
print(f'{color_grey}[{icon_color}{icon}{color_grey}]{color_none} {s}')
# Runtime warnings
def print_warning(s: str, icon = '-', icon_color = color_red):
print(f'{color_grey}[{icon_color}{icon}{color_grey}]{color_none} {s}')
# Exceptions
def print_exception(x: Exception, icon = '!', icon_color = color_red):
s = str(x)
t = type(x).__name__
print(f'{color_grey}[{icon_color}{icon}{color_grey}]{color_none} {t}: {s}')