Spack message text is just bold, not bold white now.
- added capability for just bold and just underline to color.py - Make tty.msg() display bold text instead of bold white
This commit is contained in:
parent
72f0192ddd
commit
73774c1249
2 changed files with 17 additions and 12 deletions
|
@ -42,6 +42,8 @@
|
|||
|
||||
@r Turn on red coloring
|
||||
@R Turn on bright red coloring
|
||||
@*{foo} Bold foo, but don't change text color
|
||||
@_{bar} Underline bar, but don't change text color
|
||||
@*b Turn on bold, blue text
|
||||
@_B Turn on bright blue text with an underline
|
||||
@. Revert to plain formatting
|
||||
|
@ -80,9 +82,9 @@ def __init__(self, message):
|
|||
super(ColorParseError, self).__init__(message)
|
||||
|
||||
# Text styles for ansi codes
|
||||
styles = {'*' : '1;%s', # bold
|
||||
'_' : '4:%s', # underline
|
||||
None : '0;%s' } # plain
|
||||
styles = {'*' : '1', # bold
|
||||
'_' : '4', # underline
|
||||
None : '0' } # plain
|
||||
|
||||
# Dim and bright ansi colors
|
||||
colors = {'k' : 30, 'K' : 90, # black
|
||||
|
@ -120,19 +122,22 @@ def __call__(self, match):
|
|||
return '@'
|
||||
elif m == '@.':
|
||||
return self.escape(0)
|
||||
elif m == '@' or (style and not color):
|
||||
elif m == '@':
|
||||
raise ColorParseError("Incomplete color format: '%s' in %s"
|
||||
% (m, match.string))
|
||||
elif color not in colors:
|
||||
raise ColorParseError("invalid color specifier: '%s' in '%s'"
|
||||
% (color, match.string))
|
||||
|
||||
string = styles[style]
|
||||
if color:
|
||||
if color not in colors:
|
||||
raise ColorParseError("invalid color specifier: '%s' in '%s'"
|
||||
% (color, match.string))
|
||||
string += ';' + str(colors[color])
|
||||
|
||||
colored_text = ''
|
||||
if text:
|
||||
colored_text = text + self.escape(0)
|
||||
|
||||
color_code = self.escape(styles[style] % colors[color])
|
||||
return color_code + colored_text
|
||||
return self.escape(string) + colored_text
|
||||
|
||||
|
||||
def colorize(string, **kwargs):
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
indent = " "
|
||||
|
||||
def msg(message, *args):
|
||||
cprint("@*b{==>} @*w{%s}" % cescape(message))
|
||||
cprint("@*b{==>} @*{%s}" % cescape(message))
|
||||
for arg in args:
|
||||
print indent + str(arg)
|
||||
|
||||
|
@ -43,12 +43,12 @@ def info(message, *args, **kwargs):
|
|||
|
||||
def verbose(message, *args):
|
||||
if spack.verbose:
|
||||
info(message, *args, format='*g')
|
||||
info(message, *args, format='c')
|
||||
|
||||
|
||||
def debug(*args):
|
||||
if spack.debug:
|
||||
info("Debug: " + message, *args, format='*c')
|
||||
info("Debug: " + message, *args, format='*g')
|
||||
|
||||
|
||||
def error(message, *args):
|
||||
|
|
Loading…
Reference in a new issue