Created
March 10, 2021 07:37
-
-
Save imadmali/ff8b188264c288d95b1ee70a17a08277 to your computer and use it in GitHub Desktop.
Python colored stdout/print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Colored stdout in Python (based off of blender build scripts) | |
| # Reference: https://stackoverflow.com/questions/287871/how-to-print-colored-text-to-the-terminal | |
| class bcolors: | |
| HEADER = '\033[95m' | |
| OKBLUE = '\033[94m' | |
| OKCYAN = '\033[96m' | |
| OKGREEN = '\033[92m' | |
| WARNING = '\033[93m' | |
| FAIL = '\033[91m' | |
| ENDC = '\033[0m' | |
| BOLD = '\033[1m' | |
| UNDERLINE = '\033[4m' | |
| print(bcolors.HEADER + 'Header' + bcolors.ENDC) | |
| print(bcolors.OKBLUE + 'OkBlue' + bcolors.ENDC) | |
| print(bcolors.OKCYAN + 'OkCyan' + bcolors.ENDC) | |
| print(bcolors.OKGREEN + 'OkGreen' + bcolors.ENDC) | |
| print(bcolors.WARNING + 'Warning' + bcolors.ENDC) | |
| print(bcolors.FAIL + 'Fail' + bcolors.ENDC) | |
| print(bcolors.BOLD + 'Bold' + bcolors.ENDC) | |
| print(bcolors.UNDERLINE + 'Underline' + bcolors.ENDC) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment