Skip to content

Instantly share code, notes, and snippets.

@Wegazz
Created March 13, 2020 13:31
Show Gist options
  • Save Wegazz/02ef43559df6712fec0dff73cf48208f to your computer and use it in GitHub Desktop.
Save Wegazz/02ef43559df6712fec0dff73cf48208f to your computer and use it in GitHub Desktop.
Print colored text in terminal in Python - Цветной вывод текста в консоль
# Цветной вывод текста в консоль Python.
# print colored text in terminal in Python
# get from https://stackoverflow.com/questions/287871/how-to-print-colored-text-in-terminal-in-python
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
print(f"{bcolors.HEADER}Header: No active frommets remain. Continue?{bcolors.ENDC}")
print(f"{bcolors.OKBLUE}Blue: No active frommets remain. Continue?{bcolors.ENDC}")
print(f"{bcolors.WARNING}Yellow: No active frommets remain. Continue?{bcolors.ENDC}")
print(f"{bcolors.FAIL}Red: No active frommets remain. Continue?{bcolors.ENDC}")
print(f"{bcolors.OKGREEN}Green: No active frommets remain. Continue?{bcolors.ENDC}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment