-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.py
86 lines (65 loc) · 2.66 KB
/
common.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
#? Print in different colors ----------------------------------------------
#! Red
def red(*args, end="\n"):
print("\033[91m {}\033[00m".format(''.join(map(str, args))), end=end)
#! Green
def green(*args, end="\n"):
print("\033[92m {}\033[00m".format(''.join(map(str, args))), end=end)
#! Yellow
def yellow(*args, end="\n"):
print("\033[93m {}\033[00m".format(''.join(map(str, args))), end=end)
#! Blue
def blue(*args, end="\n"):
print("\033[94m {}\033[00m".format(''.join(map(str, args))), end=end)
#! Purple
def purple(*args, end="\n"):
print("\033[95m {}\033[00m".format(''.join(map(str, args))), end=end)
#! Cyan
def cyan(*args, end="\n"):
print("\033[96m {}\033[00m".format(''.join(map(str, args))), end=end)
#! Light Gray
def lgray(*args, end="\n"):
print("\033[97m {}\033[00m".format(''.join(map(str, args))), end=end)
#! Dark Gray
def dgray(*args, end="\n"):
print("\033[90m {}\033[00m".format(''.join(map(str, args))), end=end)
#? Print in different styles ---------------------------------------------
#! Bold
def bold(*args, end="\n"):
print("\033[1m {}\033[0m".format(' '.join(map(str, args))), end=end)
#! Underline
def underline(*args, end="\n"):
print("\033[4m {}\033[0m".format(' '.join(map(str, args))), end=end)
#! Negative
def negative(*args, end="\n"):
print("\033[3m {}\033[0m".format(' '.join(map(str, args))), end=end)
#? Print in different background colors ----------------------------------
#! Red Background
def red_bg(*args, end="\n"):
print("\033[41m {}\033[00m".format(' '.join(map(str, args))), end=end)
#! Green Background
def green_bg(*args, end="\n"):
print("\033[42m {}\033[00m".format(' '.join(map(str, args))), end=end)
#! Yellow Background
def yellow_bg(*args, end="\n"):
print("\033[43m {}\033[00m".format(' '.join(map(str, args))), end=end)
#! Blue Background
def blue_bg(*args, end="\n"):
print("\033[44m {}\033[00m".format(' '.join(map(str, args))), end=end)
#! Purple Background
def purple_bg(*args, end="\n"):
print("\033[45m {}\033[00m".format(' '.join(map(str, args))), end=end)
#! Cyan Background
def cyan_bg(*args, end="\n"):
print("\033[46m {}\033[00m".format(' '.join(map(str, args))), end=end)
#! Light Gray Background
def lgray_bg(*args, end="\n"):
print("\033[47m {}\033[00m".format(' '.join(map(str, args))), end=end)
#! Dark Gray Background
def dgray_bg(*args, end="\n"):
print("\033[100m {}\033[00m".format(' '.join(map(str, args))), end=end)
#? Other -----------------------------------------------------------------
#! Easy New Line
def n(n=1):
for i in range(n):
print()