1def colored(r, g, b, text):
2 return "\033[38;2;{};{};{}m{} \033[38;2;255;255;255m".format(r, g, b, text)
3
4text = 'Hello, World'
5colored_text = colored(255, 0, 0, text)
6print(colored_text)
7
8#or
9
10print(colored(255, 0, 0, 'Hello, World'))
1class bcolors:
2 HEADER = '\033[95m'
3 OKBLUE = '\033[94m'
4 OKGREEN = '\033[92m'
5 WARNING = '\033[93m'
6 FAIL = '\033[91m'
7 ENDC = '\033[0m'
8 BOLD = '\033[1m'
9 UNDERLINE = '\033[4m'
10
11print(f"{bcolors.WARNING}Error : Test message !{bcolors.ENDC}")
1CEND = '\33[0m'
2CBOLD = '\33[1m'
3CITALIC = '\33[3m'
4CURL = '\33[4m'
5CBLINK = '\33[5m'
6CBLINK2 = '\33[6m'
7CSELECTED = '\33[7m'
8
9CBLACK = '\33[30m'
10CRED = '\33[31m'
11CGREEN = '\33[32m'
12CYELLOW = '\33[33m'
13CBLUE = '\33[34m'
14CVIOLET = '\33[35m'
15CBEIGE = '\33[36m'
16CWHITE = '\33[37m'
17
18CBLACKBG = '\33[40m'
19CREDBG = '\33[41m'
20CGREENBG = '\33[42m'
21CYELLOWBG = '\33[43m'
22CBLUEBG = '\33[44m'
23CVIOLETBG = '\33[45m'
24CBEIGEBG = '\33[46m'
25CWHITEBG = '\33[47m'
26
27CGREY = '\33[90m'
28CRED2 = '\33[91m'
29CGREEN2 = '\33[92m'
30CYELLOW2 = '\33[93m'
31CBLUE2 = '\33[94m'
32CVIOLET2 = '\33[95m'
33CBEIGE2 = '\33[96m'
34CWHITE2 = '\33[97m'
35
36CGREYBG = '\33[100m'
37CREDBG2 = '\33[101m'
38CGREENBG2 = '\33[102m'
39CYELLOWBG2 = '\33[103m'
40CBLUEBG2 = '\33[104m'
41CVIOLETBG2 = '\33[105m'
42CBEIGEBG2 = '\33[106m'
43CWHITEBG2 = '\33[107m'
44