Mercurial > hg
comparison mercurial/color.py @ 31116:6483e49204ee
color: rename '_styles' to '_defaultstyles' for clarity
This should make it clear the dict is only used for new config. Extensions
should not modify it directly anyway since we have 'extraloader' logic for
loading '_styles' too.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sun, 06 Nov 2016 20:16:54 +0100 |
parents | f5131d4f512a |
children | df0a0734304a |
comparison
equal
deleted
inserted
replaced
31115:f5131d4f512a | 31116:6483e49204ee |
---|---|
70 'purple_background': 45, | 70 'purple_background': 45, |
71 'cyan_background': 46, | 71 'cyan_background': 46, |
72 'white_background': 47, | 72 'white_background': 47, |
73 } | 73 } |
74 | 74 |
75 _styles = { | 75 _defaultstyles = { |
76 'grep.match': 'red bold', | 76 'grep.match': 'red bold', |
77 'grep.linenumber': 'green', | 77 'grep.linenumber': 'green', |
78 'grep.rev': 'green', | 78 'grep.rev': 'green', |
79 'grep.change': 'green', | 79 'grep.change': 'green', |
80 'grep.sep': 'cyan', | 80 'grep.sep': 'cyan', |
127 'tags.normal': 'green', | 127 'tags.normal': 'green', |
128 'tags.local': 'black bold', | 128 'tags.local': 'black bold', |
129 } | 129 } |
130 | 130 |
131 def loadcolortable(ui, extname, colortable): | 131 def loadcolortable(ui, extname, colortable): |
132 _styles.update(colortable) | 132 _defaultstyles.update(colortable) |
133 | 133 |
134 def _terminfosetup(ui, mode): | 134 def _terminfosetup(ui, mode): |
135 '''Initialize terminfo data and the terminal if we're in terminfo mode.''' | 135 '''Initialize terminfo data and the terminal if we're in terminfo mode.''' |
136 | 136 |
137 # If we failed to load curses, we go ahead and return. | 137 # If we failed to load curses, we go ahead and return. |
252 if always or (auto and formatted): | 252 if always or (auto and formatted): |
253 return realmode | 253 return realmode |
254 return None | 254 return None |
255 | 255 |
256 def configstyles(ui): | 256 def configstyles(ui): |
257 ui._styles.update(_styles) | 257 ui._styles.update(_defaultstyles) |
258 for status, cfgeffects in ui.configitems('color'): | 258 for status, cfgeffects in ui.configitems('color'): |
259 if '.' not in status or status.startswith(('color.', 'terminfo.')): | 259 if '.' not in status or status.startswith(('color.', 'terminfo.')): |
260 continue | 260 continue |
261 cfgeffects = ui.configlist('color', status) | 261 cfgeffects = ui.configlist('color', status) |
262 if cfgeffects: | 262 if cfgeffects: |