-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolog.py
50 lines (36 loc) · 1.35 KB
/
colog.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
BLACK_COLOR="\u001b[30m"
def black(stringToColor):
return BLACK_COLOR + str(stringToColor) + RESET_COLOR
RED_COLOR="\u001b[31m"
def red(stringToColor):
return RED_COLOR + str(stringToColor) + RESET_COLOR
GREEN_COLOR="\u001b[32m"
def green(stringToColor):
return GREEN_COLOR + str(stringToColor) + RESET_COLOR
YELLOW_COLOR="\u001b[33m"
def yellow(stringToColor):
return YELLOW_COLOR + str(stringToColor) + RESET_COLOR
BLUE_COLOR="\u001b[34m"
def blue(stringToColor):
return BLUE_COLOR + str(stringToColor) + RESET_COLOR
MAGENTA_COLOR="\u001b[35m"
def magenta(stringToColor):
return MAGENTA_COLOR + str(stringToColor) + RESET_COLOR
CYAN_COLOR="\u001b[36m"
def cyan(stringToColor):
return CYAN_COLOR + str(stringToColor) + RESET_COLOR
WHITE_COLOR="\u001b[37m"
def white(stringToColor):
return WHITE_COLOR + str(stringToColor) + RESET_COLOR
RESET_COLOR="\u001b[0m"
def reset(stringToColor):
return RESET_COLOR + str(stringToColor) + RESET_COLOR
# If you want to add other colors (i.e. the "bright ones")
# Go there : https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
# Copy paste the codes you want like this :
# Black: \u001b[30m
# Red: \u001b[31m
# Then research for this regex :
# ([A-Za-z]*): (\\u001b\[\d*m)
# And replace by this
# \U$1_COLOR="$2"\ndef \L$1(stringToColor):\n\treturn \U$1_COLOR + str(stringToColor) + RESET_COLOR\n