Created
June 12, 2015 05:18
-
-
Save samliu/3950823bd6ec34e9f178 to your computer and use it in GitHub Desktop.
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
class ColorPrinter(object): | |
"""Class to print with color.""" | |
def __init__(self): | |
self.colors = { | |
"HEADER": '\033[95m', | |
"OKBLUE": '\033[94m', | |
"OKGREEN": '\033[92m', | |
"WARNING": '\033[93m', | |
"FAIL": '\033[91m', | |
"ENDC": '\033[0m', | |
"BOLD": '\033[1m', | |
"UNDERLINE": '\033[4m', | |
} | |
def println(self, text, color="NONE"): | |
if color in self.colors: | |
print self.colors[color] + text + self.colors["ENDC"] | |
else: | |
print text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment