So, recently I’ve been working on a Virtual Pet Game in Python (https://github.com/lunacodes/pypet). It’s terminal/command line based right now, and I needed a way for it to stand out & not just look like an endless blob of terminal tests. I had seen a talk of Tom Ballinger’s about Outputting Colors to the Terminal, and after a bit of Research, I found Colorama.
Colorama is wonderful in that it’s Cross-Platform, and Exceedingly Simple to use!!
The gyst is:
from colorama import init init()
from colorama import Fore, Back, Style print(Fore.RED + 'some red text') print(Back.GREEN + 'and with a green background') print(Style.DIM + 'and in dim text') print(Fore.RESET + Back.RESET + Style.RESET_ALL) print('back to normal now')
You can also use ANSI Codes or existing ANSI Libraries (such as Termcolor)
It’s such a fun & easy way to add a Colorful & Nice touch to your Terminal Programs 🙂