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}")