-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli_color.py
55 lines (42 loc) · 1.27 KB
/
cli_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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
# -* vim: syntax=python -*-
class Color:
"""
Helper class to easily print colored & formatted lines
"""
# ↓ Format lines ↓
@staticmethod
def bold(text: str) -> str:
return f"\033[1m{text}\033[m"
@staticmethod
def underline(text: str) -> str:
return f"\033[4m{text}\033[m"
@staticmethod
def title(text: str) -> str:
spacer = " "
return f"💨 💨 💨\n{spacer + Color.bold(Color.underline(text))}\n{spacer}💨 💨 💨"
# ↓ Color lines ↓
@staticmethod
def blue(text: str) -> str:
return f"\033[94m{text}\033[m"
@staticmethod
def cyan(text: str) -> str:
return f"\033[0;36m{text}\033[m"
@staticmethod
def darkcyan(text: str) -> str:
return f"\033[36m{text}\033[m"
@staticmethod
def green(text: str) -> str:
return f"\033[0;32m{text}\033[m"
@staticmethod
def purple(text: str) -> str:
return f"\033[95m{text}\033[m"
@staticmethod
def red(text: str) -> str:
return f"\033[0;31m{text}\033[m"
@staticmethod
def white(text: str) -> str:
return f"\033[1;37m{text}\033[m"
@staticmethod
def yellow(text: str) -> str:
return f"\033[1;33m{text}\033[m"