Q:

python color in console

class bcolors:
    HEADER = '\033[95m'
    OKBLUE = '\033[94m'
    OKGREEN = '\033[92m'
    WARNING = '\033[93m'
    FAIL = '\033[91m'
    ENDC = '\033[0m'
    BOLD = '\033[1m'
    UNDERLINE = '\033[4m'

print(f"{bcolors.WARNING}Error : Test message !{bcolors.ENDC}")
3
"\033[1;32;40m Bright Green"
#\033[  Escape code, this is always the same
#1 = Style, 1 for normal.
#32 = Text colour, 32 for bright green.
#40m = Background colour, 40 is for black.
"\033[1;30;40m Black"
"\033[1;31;40m Red"
"\033[1;32;40m Bright Green"
"\033[1;33;40m Yellow"
"\033[1;34;40m Blue"
"\033[1;35;40m Purple"
"\033[1;36;40m Cyan"
"\033[1;37;40m White"
2

New to Communities?

Join the community