Skip to content

Instantly share code, notes, and snippets.

@BenRogersWPG
Last active November 14, 2021 00:52
Show Gist options
  • Save BenRogersWPG/81d4bb5e637929908037acb50c7f5249 to your computer and use it in GitHub Desktop.
Save BenRogersWPG/81d4bb5e637929908037acb50c7f5249 to your computer and use it in GitHub Desktop.
Colorful Python Print Statements
#Print a line to the console in red text:
print(f'\033[31mThis is red text\033[0m')
#Print a line to the console in green text:
print(f'\033[32mThis is green text\033[0m')
#Print a line to the console in yellow text:
print(f'\033[33mThis is yellow text\033[0m')
#Print a line to the console in blue text:
print(f'\033[34mThis is blue text\033[0m')
#Print a line to the console in magenta text:
print(f'\033[35mThis is magenta text\033[0m')
#Print a line to the console in white text:
print(f'\033[37mThis is white text\033[0m')
#Print a line to the console in black text:
print(f'\033[30mThis is black text\033[0m')
#Print a line to the console in highlighted text:
print(f'\033[41mThis is highlighted text\033[0m')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment