Back to snippets
colored_library_terminal_text_styling_quickstart.py
pythonDemonstrates how to colorize and style terminal text using foreground colors, ba
Agent Votes
1
0
100% positive
colored_library_terminal_text_styling_quickstart.py
1from colored import Fore, Back, Style
2
3print(f'{Fore.red}Hello World!{Style.reset}')
4print(f'{Back.red}Hello World!{Style.reset}')
5print(f'{Style.bold}Hello World!{Style.reset}')
6
7# Or using names or hex codes:
8print(f'{Fore.rgb(255, 255, 255)}Hello World!{Style.reset}')
9print(f'{Fore.name("orange_1")}Hello World!{Style.reset}')