-
Notifications
You must be signed in to change notification settings - Fork 4
/
style.py
380 lines (287 loc) · 12.1 KB
/
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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
""" _..._ ___
.:::::::. `"-._.-''.
, /:::::::::\ ': \ _._
\:-::::::::::::\ :. | /|.-' /:::\
\::::::::\:::::| ': | | / |:::|
`:::::::|:::::\ ': | `\ | __ |\::/\
-:::-|::::::| ': | .`\ .\_.' `.__/ |
|::::::\ ':. | \ ';:: /.-._ , /
|:::::::| :. / ,`\;:: \'./0) |_.-/
;:::::::| ': | \.`;::. `` | |
\::::::/ :' / _\::::' / /
\::::| :' / ,=:;::/ |
\:::| :' | (='` // / |
\::\ `: / '--' | /\ |
GITHUB.COM/SKUNK-INK \:::. `:_|.-"`"-. \__.-'/::\ |
░▒█▀▀▀█░▒█░▄▀░▒█░▒█░▒█▄░▒█░▒█░▄▀ '::::.:::...:::. '. /:::| |
░░▀▀▀▄▄░▒█▀▄░░▒█░▒█░▒█▒█▒█░▒█▀▄░ '::/::::::::::::. '-.__.:::::| |
░▒█▄▄▄█░▒█░▒█░░▀▄▄▀░▒█░░▀█░▒█░▒█ |::::::::::::\::..../::::::| /
|:::::::::::::|::::/::::::://
░▒█░░▒█░▒█▀▀▀█░▒█▀▀▄░▒█░▄▀░▒█▀▀▀█ \:::::::::::::|'::/::::::::/
░▒█▒█▒█░▒█░░▒█░▒█▄▄▀░▒█▀▄░░░▀▀▀▄▄ /\::::::::::::/ /:::::::/:|
░▒▀▄▀▄▀░▒█▄▄▄█░▒█░▒█░▒█░▒█░▒█▄▄▄█ |::';:::::::::/ |::::::/::;
HANDSHAKE API WRAPPER |:::/`-:::::;;-._ |:::::/::/
|:::| `-::::\ `|::::/::/
|:::| \:::\ \:::/::/
/:::/ \:::\ \:/\:/
(_::/ \:::;__ \\_\\___
(_:/ \::):):)\:::):):)
`" `""""` `""""""`
"""
# FONT COLORS
magenta_foreground = '\033[95m'
white_foreground = '\033[97m'
black_foreground = '\033[30m'
blue_foreground = '\033[94m'
cyan_foreground = '\033[96m'
green_foreground = '\033[92m'
yellow_foreground = '\033[93m'
red_foreground = '\033[91m'
# FONT BACKGROUNDS
white_background = '\033[107m'
red_background = '\033[41m'
green_background = '\033[102m'
blue_background = '\033[44m'
# FONT STYLES
style_bold = '\033[1m'
style_underline = '\033[4m'
style_italic = '\033[3m'
# CUSTOM FONT STYLES
alert = '\033[1m\033[41m'
# ESCAPE SEQUENCE
endc = '\033[0m'
def font(text:str, color:str = None, background:str = None, style:str = None, bold:bool = False, underline:bool = False, italic:bool = False):
"""
DESCRIPTION:
This function is used to create custom colored text.
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
( ) color : The color of the text.
Options are: black, white, yellow, red, blue, green.
( ) background : The background color of the text.
Options: black, red, green, yellow, blue, magenta, cyan, white.
( ) style : The style of the text.
Options: bold, underline, and italic.
( ) bold : If the text should be bold.
( ) underline : If the text should be underlined.
( ) italic : If the text should be italic.
"""
if color == 'white':
text = white_foreground + text + endc
elif color == 'red':
text = red_foreground + text + endc
elif color == 'green':
text = green_foreground + text + endc
elif color == 'blue':
text = blue_foreground + text + endc
elif color == 'yellow':
text = yellow_foreground + text + endc
elif color == 'cyan':
text = cyan_foreground + text + endc
elif color == 'magenta':
text = magenta_foreground + text + endc
elif color == 'black':
text = black_foreground + text + endc
if background == 'white':
text = white_background + text + endc
elif background == 'red':
text = red_background + text + endc
elif background == 'green':
text = green_background + text + endc
elif background == 'blue':
text = blue_background + text + endc
if style == 'bold' or bold:
text = style_bold + text + endc
elif style == 'underline' or underline:
text = style_underline + text + endc
elif style == 'italic' or italic:
text = style_italic + text + endc
return text
########################################################## END: font(color, text, background, style)
######################################################################
## ##
## FONT COLORS ##
## ##
######################################################################
def black_font(text):
"""
DESCRIPTION:
This function is used to create black text
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return black_foreground + text + endc
########################################################## END: black_font(text)
def white_font(text):
"""
DESCRIPTION:
This function is used to create white text
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return white_foreground + text + endc
########################################################## END: white_font(text)
def yellow_font(text):
"""
DESCRIPTION:
This function is used to create yellow text
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored."""
return yellow_foreground + text + endc
########################################################## END: yellow_font(text)
def red_font(text):
"""
DESCRIPTION:
This function is used to create red text
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return red_foreground + text + endc
########################################################## END: red_font(text)
def blue_font(text):
"""
DESCRIPTION:
This function is used to create blue text
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return blue_foreground + text + endc
########################################################## END: blue_font(text)
def green_font(text):
"""
DESCRIPTION:
This function is used to create green text
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return green_foreground + text + endc
########################################################## END: green_font(text)
def cyan_font(text):
"""
DESCRIPTION:
This function is used to create cyan text
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return cyan_foreground + text + endc
########################################################## END: cyan_font(text)
##################################################################
## ##
## BACKGROUND COLORS ##
## ##
##################################################################
def white_bg(text):
"""
DESCRIPTION:
This function is used to create text with a white background.
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return white_background + text + endc
########################################################## END: white_bg(text)
def red_bg(text):
"""
DESCRIPTION:
This function is used to create text with a red background.
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return red_background + text + endc
########################################################## END: red_bg(text)
def green_bg(text):
"""
DESCRIPTION:
This function is used to create text with a green background.
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return green_background + text + endc
########################################################## END: green_bg(text)
def blue_bg(text):
"""
DESCRIPTION:
This function is used to create text with a blue background.
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return blue_background + text + endc
########################################################## END: blue_bg(text)
##################################################################
## ##
## FONT STYLES ##
## ##
##################################################################
def bold_font(text):
"""
DESCRIPTION:
This function is used to create bold text.
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return style_bold + text + endc
########################################################## END: bold_font(text)
def underline_font(text):
"""
DESCRIPTION:
This function is used to create underlined text.
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return style_underline + text + endc
########################################################## END: underline_font(text)
def italic_font(text):
"""
DESCRIPTION:
This function is used to create italic text.
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return style_italic + text + endc
########################################################## END: italic_font(text)
##################################################################
## ##
## CUSTOM FONT THEMES ##
## ##
##################################################################
def title_style(text):
"""
DESCRIPTION:
This function is used to create green menu titles.
"""
return style_underline + style_bold + text + endc + endc
########################################################## END: title(text)
def prompt_style(text):
"""
DESCRIPTION:
This function is used to create yellow prompt text.
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
return yellow_foreground + style_bold + text + endc + endc
########################################################## END: prompt(text)
def error_style(text):
"""
DESCRIPTION:
This function is used to create red error text.
PARAMETERS:
(*) Denotes a required parameter.
(*) text : The text to be colored.
"""
text = ' ERROR : ' + text + ' '
return red_background + white_foreground + text + endc + endc