diff options
author | 2014-09-08 01:16:38 +0200 | |
---|---|---|
committer | 2014-09-14 11:03:34 +0200 | |
commit | be1df32bd3faa571343913da7f88d6b40378b195 (patch) | |
tree | fb2d9ff8ce2eb57d0ed42657dcc8be53f972c03d /pyload/lib/colorama/ansi.py | |
parent | Restructure pyload file tree (1) (diff) | |
download | pyload-be1df32bd3faa571343913da7f88d6b40378b195.tar.xz |
New printer (windows compatible)
Diffstat (limited to 'pyload/lib/colorama/ansi.py')
-rw-r--r-- | pyload/lib/colorama/ansi.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/pyload/lib/colorama/ansi.py b/pyload/lib/colorama/ansi.py new file mode 100644 index 000000000..5dfe374ce --- /dev/null +++ b/pyload/lib/colorama/ansi.py @@ -0,0 +1,50 @@ +# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. +''' +This module generates ANSI character codes to printing colors to terminals. +See: http://en.wikipedia.org/wiki/ANSI_escape_code +''' + +CSI = '\033[' + +def code_to_chars(code): + return CSI + str(code) + 'm' + +class AnsiCodes(object): + def __init__(self, codes): + for name in dir(codes): + if not name.startswith('_'): + value = getattr(codes, name) + setattr(self, name, code_to_chars(value)) + +class AnsiFore: + BLACK = 30 + RED = 31 + GREEN = 32 + YELLOW = 33 + BLUE = 34 + MAGENTA = 35 + CYAN = 36 + WHITE = 37 + RESET = 39 + +class AnsiBack: + BLACK = 40 + RED = 41 + GREEN = 42 + YELLOW = 43 + BLUE = 44 + MAGENTA = 45 + CYAN = 46 + WHITE = 47 + RESET = 49 + +class AnsiStyle: + BRIGHT = 1 + DIM = 2 + NORMAL = 22 + RESET_ALL = 0 + +Fore = AnsiCodes( AnsiFore ) +Back = AnsiCodes( AnsiBack ) +Style = AnsiCodes( AnsiStyle ) + |