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
@ -42,6 +42,8 @@
|
|||||||
|
|
||||||
@r Turn on red coloring
|
@r Turn on red coloring
|
||||||
@R Turn on bright 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 bold, blue text
|
||||||
@_B Turn on bright blue text with an underline
|
@_B Turn on bright blue text with an underline
|
||||||
@. Revert to plain formatting
|
@. Revert to plain formatting
|
||||||
@ -80,9 +82,9 @@ def __init__(self, message):
|
|||||||
super(ColorParseError, self).__init__(message)
|
super(ColorParseError, self).__init__(message)
|
||||||
|
|
||||||
# Text styles for ansi codes
|
# Text styles for ansi codes
|
||||||
styles = {'*' : '1;%s', # bold
|
styles = {'*' : '1', # bold
|
||||||
'_' : '4:%s', # underline
|
'_' : '4', # underline
|
||||||
None : '0;%s' } # plain
|
None : '0' } # plain
|
||||||
|
|
||||||
# Dim and bright ansi colors
|
# Dim and bright ansi colors
|
||||||
colors = {'k' : 30, 'K' : 90, # black
|
colors = {'k' : 30, 'K' : 90, # black
|
||||||
@ -120,19 +122,22 @@ def __call__(self, match):
|
|||||||
return '@'
|
return '@'
|
||||||
elif m == '@.':
|
elif m == '@.':
|
||||||
return self.escape(0)
|
return self.escape(0)
|
||||||
elif m == '@' or (style and not color):
|
elif m == '@':
|
||||||
raise ColorParseError("Incomplete color format: '%s' in %s"
|
raise ColorParseError("Incomplete color format: '%s' in %s"
|
||||||
% (m, match.string))
|
% (m, match.string))
|
||||||
elif color not in colors:
|
|
||||||
raise ColorParseError("invalid color specifier: '%s' in '%s'"
|
string = styles[style]
|
||||||
% (color, match.string))
|
if color:
|
||||||
|
if color not in colors:
|
||||||
|
raise ColorParseError("invalid color specifier: '%s' in '%s'"
|
||||||
|
% (color, match.string))
|
||||||
|
string += ';' + str(colors[color])
|
||||||
|
|
||||||
colored_text = ''
|
colored_text = ''
|
||||||
if text:
|
if text:
|
||||||
colored_text = text + self.escape(0)
|
colored_text = text + self.escape(0)
|
||||||
|
|
||||||
color_code = self.escape(styles[style] % colors[color])
|
return self.escape(string) + colored_text
|
||||||
return color_code + colored_text
|
|
||||||
|
|
||||||
|
|
||||||
def colorize(string, **kwargs):
|
def colorize(string, **kwargs):
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
indent = " "
|
indent = " "
|
||||||
|
|
||||||
def msg(message, *args):
|
def msg(message, *args):
|
||||||
cprint("@*b{==>} @*w{%s}" % cescape(message))
|
cprint("@*b{==>} @*{%s}" % cescape(message))
|
||||||
for arg in args:
|
for arg in args:
|
||||||
print indent + str(arg)
|
print indent + str(arg)
|
||||||
|
|
||||||
@ -43,12 +43,12 @@ def info(message, *args, **kwargs):
|
|||||||
|
|
||||||
def verbose(message, *args):
|
def verbose(message, *args):
|
||||||
if spack.verbose:
|
if spack.verbose:
|
||||||
info(message, *args, format='*g')
|
info(message, *args, format='c')
|
||||||
|
|
||||||
|
|
||||||
def debug(*args):
|
def debug(*args):
|
||||||
if spack.debug:
|
if spack.debug:
|
||||||
info("Debug: " + message, *args, format='*c')
|
info("Debug: " + message, *args, format='*g')
|
||||||
|
|
||||||
|
|
||||||
def error(message, *args):
|
def error(message, *args):
|
||||||
|
Loading…
Reference in New Issue
Block a user