Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Side by Side Diff: third_party/colorama/ansi.py

Issue 8371006: Reapply r106708 "Include initial use of colorama" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/colorama/__init__.py ('k') | third_party/colorama/ansitowin32.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 '''
2 This module generates ANSI character codes to printing colors to terminals.
3 See: http://en.wikipedia.org/wiki/ANSI_escape_code
4 '''
5
6 CSI = '\033['
7
8 def code_to_chars(code):
9 return CSI + str(code) + 'm'
10
11 class AnsiCodes(object):
12 def __init__(self, codes):
13 for name in dir(codes):
14 if not name.startswith('_'):
15 value = getattr(codes, name)
16 setattr(self, name, code_to_chars(value))
17
18 class AnsiFore:
19 BLACK = 30
20 RED = 31
21 GREEN = 32
22 YELLOW = 33
23 BLUE = 34
24 MAGENTA = 35
25 CYAN = 36
26 WHITE = 37
27 RESET = 39
28
29 class AnsiBack:
30 BLACK = 40
31 RED = 41
32 GREEN = 42
33 YELLOW = 43
34 BLUE = 44
35 MAGENTA = 45
36 CYAN = 46
37 WHITE = 47
38 RESET = 49
39
40 class AnsiStyle:
41 BRIGHT = 1
42 DIM = 2
43 NORMAL = 22
44 RESET_ALL = 0
45
46 Fore = AnsiCodes( AnsiFore )
47 Back = AnsiCodes( AnsiBack )
48 Style = AnsiCodes( AnsiStyle )
49
OLDNEW
« no previous file with comments | « third_party/colorama/__init__.py ('k') | third_party/colorama/ansitowin32.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698