Created
January 21, 2019 08:05
-
-
Save theeluwin/b08b3a12d6889828dd6cc9a1092ad9c1 to your computer and use it in GitHub Desktop.
color 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
| # origin: https://github.com/fabric/fabric/blob/1.14/fabric/colors.py | |
| import os | |
| def _wrap_with(code): | |
| def inner(text, bold=False): | |
| c = code | |
| if os.environ.get('FABRIC_DISABLE_COLORS'): | |
| return text | |
| if bold: | |
| c = "1;%s" % c | |
| return "\033[%sm%s\033[0m" % (c, text) | |
| return inner | |
| red = _wrap_with('31') | |
| green = _wrap_with('32') | |
| yellow = _wrap_with('33') | |
| blue = _wrap_with('34') | |
| magenta = _wrap_with('35') | |
| cyan = _wrap_with('36') | |
| white = _wrap_with('37') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment