Add support for NO_COLOR.
@@ -529,7 +529,9 @@ def colorize(color_name, text):
"""Colorize text if colored output is enabled. (Like _colorize but
conditional.)
"""
- if config['ui']['color']:
+ if not config['ui']['color'] or 'NO_COLOR' in os.environ.keys():
+ return text
+
global COLORS
if not COLORS:
COLORS = dict((name,
@@ -542,8 +544,6 @@ def colorize(color_name, text):
log.debug(u'Invalid color_name: {0}', color_name)
color = color_name
return _colorize(color, text)
- else:
- return text
def _colordiff(a, b, highlight='text_highlight',
