##// END OF EJS Templates
color: reinvent dictionary...
Pierre-Yves David -
r31109:53230c5b default
parent child Browse files
Show More
@@ -19,105 +19,111 b' try:'
19 import curses
19 import curses
20 # Mapping from effect name to terminfo attribute name (or raw code) or
20 # Mapping from effect name to terminfo attribute name (or raw code) or
21 # color number. This will also force-load the curses module.
21 # color number. This will also force-load the curses module.
22 _terminfo_params = {'none': (True, 'sgr0', ''),
22 _terminfo_params = {
23 'standout': (True, 'smso', ''),
23 'none': (True, 'sgr0', ''),
24 'underline': (True, 'smul', ''),
24 'standout': (True, 'smso', ''),
25 'reverse': (True, 'rev', ''),
25 'underline': (True, 'smul', ''),
26 'inverse': (True, 'rev', ''),
26 'reverse': (True, 'rev', ''),
27 'blink': (True, 'blink', ''),
27 'inverse': (True, 'rev', ''),
28 'dim': (True, 'dim', ''),
28 'blink': (True, 'blink', ''),
29 'bold': (True, 'bold', ''),
29 'dim': (True, 'dim', ''),
30 'invisible': (True, 'invis', ''),
30 'bold': (True, 'bold', ''),
31 'italic': (True, 'sitm', ''),
31 'invisible': (True, 'invis', ''),
32 'black': (False, curses.COLOR_BLACK, ''),
32 'italic': (True, 'sitm', ''),
33 'red': (False, curses.COLOR_RED, ''),
33 'black': (False, curses.COLOR_BLACK, ''),
34 'green': (False, curses.COLOR_GREEN, ''),
34 'red': (False, curses.COLOR_RED, ''),
35 'yellow': (False, curses.COLOR_YELLOW, ''),
35 'green': (False, curses.COLOR_GREEN, ''),
36 'blue': (False, curses.COLOR_BLUE, ''),
36 'yellow': (False, curses.COLOR_YELLOW, ''),
37 'magenta': (False, curses.COLOR_MAGENTA, ''),
37 'blue': (False, curses.COLOR_BLUE, ''),
38 'cyan': (False, curses.COLOR_CYAN, ''),
38 'magenta': (False, curses.COLOR_MAGENTA, ''),
39 'white': (False, curses.COLOR_WHITE, '')}
39 'cyan': (False, curses.COLOR_CYAN, ''),
40 'white': (False, curses.COLOR_WHITE, ''),
41 }
40 except ImportError:
42 except ImportError:
41 curses = None
43 curses = None
42 _terminfo_params = {}
44 _terminfo_params = {}
43
45
44 # start and stop parameters for effects
46 # start and stop parameters for effects
45 _effects = {'none': 0,
47 _effects = {
46 'black': 30,
48 'none': 0,
47 'red': 31,
49 'black': 30,
48 'green': 32,
50 'red': 31,
49 'yellow': 33,
51 'green': 32,
50 'blue': 34,
52 'yellow': 33,
51 'magenta': 35,
53 'blue': 34,
52 'cyan': 36,
54 'magenta': 35,
53 'white': 37,
55 'cyan': 36,
54 'bold': 1,
56 'white': 37,
55 'italic': 3,
57 'bold': 1,
56 'underline': 4,
58 'italic': 3,
57 'inverse': 7,
59 'underline': 4,
58 'dim': 2,
60 'inverse': 7,
59 'black_background': 40,
61 'dim': 2,
60 'red_background': 41,
62 'black_background': 40,
61 'green_background': 42,
63 'red_background': 41,
62 'yellow_background': 43,
64 'green_background': 42,
63 'blue_background': 44,
65 'yellow_background': 43,
64 'purple_background': 45,
66 'blue_background': 44,
65 'cyan_background': 46,
67 'purple_background': 45,
66 'white_background': 47}
68 'cyan_background': 46,
69 'white_background': 47,
70 }
67
71
68 _styles = {'grep.match': 'red bold',
72 _styles = {
69 'grep.linenumber': 'green',
73 'grep.match': 'red bold',
70 'grep.rev': 'green',
74 'grep.linenumber': 'green',
71 'grep.change': 'green',
75 'grep.rev': 'green',
72 'grep.sep': 'cyan',
76 'grep.change': 'green',
73 'grep.filename': 'magenta',
77 'grep.sep': 'cyan',
74 'grep.user': 'magenta',
78 'grep.filename': 'magenta',
75 'grep.date': 'magenta',
79 'grep.user': 'magenta',
76 'bookmarks.active': 'green',
80 'grep.date': 'magenta',
77 'branches.active': 'none',
81 'bookmarks.active': 'green',
78 'branches.closed': 'black bold',
82 'branches.active': 'none',
79 'branches.current': 'green',
83 'branches.closed': 'black bold',
80 'branches.inactive': 'none',
84 'branches.current': 'green',
81 'diff.changed': 'white',
85 'branches.inactive': 'none',
82 'diff.deleted': 'red',
86 'diff.changed': 'white',
83 'diff.diffline': 'bold',
87 'diff.deleted': 'red',
84 'diff.extended': 'cyan bold',
88 'diff.diffline': 'bold',
85 'diff.file_a': 'red bold',
89 'diff.extended': 'cyan bold',
86 'diff.file_b': 'green bold',
90 'diff.file_a': 'red bold',
87 'diff.hunk': 'magenta',
91 'diff.file_b': 'green bold',
88 'diff.inserted': 'green',
92 'diff.hunk': 'magenta',
89 'diff.tab': '',
93 'diff.inserted': 'green',
90 'diff.trailingwhitespace': 'bold red_background',
94 'diff.tab': '',
91 'changeset.public' : '',
95 'diff.trailingwhitespace': 'bold red_background',
92 'changeset.draft' : '',
96 'changeset.public' : '',
93 'changeset.secret' : '',
97 'changeset.draft' : '',
94 'diffstat.deleted': 'red',
98 'changeset.secret' : '',
95 'diffstat.inserted': 'green',
99 'diffstat.deleted': 'red',
96 'histedit.remaining': 'red bold',
100 'diffstat.inserted': 'green',
97 'ui.prompt': 'yellow',
101 'histedit.remaining': 'red bold',
98 'log.changeset': 'yellow',
102 'ui.prompt': 'yellow',
99 'patchbomb.finalsummary': '',
103 'log.changeset': 'yellow',
100 'patchbomb.from': 'magenta',
104 'patchbomb.finalsummary': '',
101 'patchbomb.to': 'cyan',
105 'patchbomb.from': 'magenta',
102 'patchbomb.subject': 'green',
106 'patchbomb.to': 'cyan',
103 'patchbomb.diffstats': '',
107 'patchbomb.subject': 'green',
104 'rebase.rebased': 'blue',
108 'patchbomb.diffstats': '',
105 'rebase.remaining': 'red bold',
109 'rebase.rebased': 'blue',
106 'resolve.resolved': 'green bold',
110 'rebase.remaining': 'red bold',
107 'resolve.unresolved': 'red bold',
111 'resolve.resolved': 'green bold',
108 'shelve.age': 'cyan',
112 'resolve.unresolved': 'red bold',
109 'shelve.newest': 'green bold',
113 'shelve.age': 'cyan',
110 'shelve.name': 'blue bold',
114 'shelve.newest': 'green bold',
111 'status.added': 'green bold',
115 'shelve.name': 'blue bold',
112 'status.clean': 'none',
116 'status.added': 'green bold',
113 'status.copied': 'none',
117 'status.clean': 'none',
114 'status.deleted': 'cyan bold underline',
118 'status.copied': 'none',
115 'status.ignored': 'black bold',
119 'status.deleted': 'cyan bold underline',
116 'status.modified': 'blue bold',
120 'status.ignored': 'black bold',
117 'status.removed': 'red bold',
121 'status.modified': 'blue bold',
118 'status.unknown': 'magenta bold underline',
122 'status.removed': 'red bold',
119 'tags.normal': 'green',
123 'status.unknown': 'magenta bold underline',
120 'tags.local': 'black bold'}
124 'tags.normal': 'green',
125 'tags.local': 'black bold',
126 }
121
127
122 def loadcolortable(ui, extname, colortable):
128 def loadcolortable(ui, extname, colortable):
123 _styles.update(colortable)
129 _styles.update(colortable)
General Comments 0
You need to be logged in to leave comments. Login now