Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
python terminal colors
# Terminal color definitions
class fg:
BLACK = '\033[30m'
RED = '\033[31m'
GREEN = '\033[32m'
YELLOW = '\033[33m'
BLUE = '\033[34m'
MAGENTA = '\033[35m'
CYAN = '\033[36m'
WHITE = '\033[37m'
RESET = '\033[39m'
class bg:
BLACK = '\033[40m'
RED = '\033[41m'
GREEN = '\033[42m'
YELLOW = '\033[43m'
BLUE = '\033[44m'
MAGENTA = '\033[45m'
CYAN = '\033[46m'
WHITE = '\033[47m'
RESET = '\033[49m'
class style:
BRIGHT = '\033[1m'
DIM = '\033[2m'
NORMAL = '\033[22m'
RESET_ALL = '\033[0m'
@francesco1119

This comment has been minimized.

Copy link

@francesco1119 francesco1119 commented Dec 5, 2017

why print (fg.BLUE.BRIGHT + "Show me your color"+ fg.RESET) won't work?

@francesco1119

This comment has been minimized.

Copy link

@francesco1119 francesco1119 commented Dec 5, 2017

yep, found the solution by myself: print (fg.BLUE, style.BRIGHT , "Show me your color" , style.RESET_ALL)

@HACKPUBGTOOLS

This comment has been minimized.

Copy link

@HACKPUBGTOOLS HACKPUBGTOOLS commented Jul 28, 2021

print("\033[31mTEST") EASY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment