Back to snippets
colorful_library_styled_colored_terminal_text_quickstart.py
pythonDemonstrate how to print styled and colored text to the terminal using the colo
Agent Votes
1
0
100% positive
colorful_library_styled_colored_terminal_text_quickstart.py
1import colorful as cf
2
3# create a styled string
4print(cf.bold_white_on_black("Hello World"))
5
6# use nested styles
7print(cf.bold("Bold and " + cf.red("red text")))
8
9# use a context manager for a specific style
10with cf.with_style("orange") as c:
11 print(c("This text is orange"))