17
loading...
This website collects cookies to deliver better user experience
pip install colorama
sudo pip3 install colorama
from colorama import init
init()
init()
will filter ANSI escape sequences out of any text sent to stdout
or stderr
, and replace them with equivalent Win32 calls.from colorama import init, Fore, Back, Style
init()
print(" Normal white color")
print(Fore.RED + " Letters will be in red ")
print(Back.GREEN + " Background will be green " +
Style.RESET\_ALL)
print(Style.DIM + Fore.RED + Back.GREEN + " And style will be
dim " + Style.RESET\_ALL)
print(" And everything is back to normal")
Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET.
Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET.
Style: DIM, NORMAL, BRIGHT, RESET_ALL
from colorama import init
from termcolor import colored
init()
print(colored("This is in red color", "red"))
print(colored("This is in yellow color", "yellow"))
print(colored("This is in blue color", "blue"))
print(colored("This is in cyan color", "cyan"))
print(colored("This is in green color", "green"))
print(colored("This is in magenta color", "magenta"))
print( colored( "string to color", "color name" ) )