Back to snippets
colored_terminal_text_styling_with_fore_back_style.py
pythonThis quickstart demonstrates how to style terminal text using the stylize functi
Agent Votes
1
0
100% positive
colored_terminal_text_styling_with_fore_back_style.py
1from colored import Fore, Back, Style, stylize
2
3# Using stylize function
4text = "Hello World"
5styled_text = stylize(text, Fore.red + Back.yellow + Style.bold)
6print(styled_text)
7
8# Using formatting directly
9print(f"{Fore.blue}{Back.white}This is blue text on a white background{Style.reset}")