Created
July 24, 2016 20:47
-
-
Save ricrogz/bc703072dd101cf0cf6b39edd4540557 to your computer and use it in GitHub Desktop.
Python: colors on console output
This file contains 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
import colorama | |
# Optional?? I did not put it in my code, and outputs colors just fine. | |
# colorama.init() | |
print(colorama.Fore.RED + 'some red text') | |
print(colorama.Back.GREEN + 'and with a green background') | |
print(colorama.Style.DIM + 'and in dim text') | |
print(colorama.Style.RESET_ALL) | |
print('back to normal now') | |
""" | |
Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. | |
Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. | |
Style: DIM, NORMAL, BRIGHT, RESET_ALL | |
Style.BRIGHT makes text bold. | |
Style.RESET_ALL resets both style and colors. | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment