Make git cl status use bold colors

Normal weight colored text can be hard to read, especially over Chrome
Remote Desktop (video compression treats chroma harshly). Git colors can
be made more readable by editing .gitconfig, but git cl colors are hard
coded. This hard codes them to all be bold, for greater readability and
effective brightness, and changes the still-too-dim-over-CRD blue to red.

Magic bold code found here:
https://stackoverflow.com/questions/8924173/how-do-i-print-bold-text-in-python

Change-Id: If3a8684d1886291ca692d6fdbe7e30095a5acbc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116941
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
changes/41/2116941/4
Bruce Dawson 5 years ago committed by LUCI CQ
parent b3e593c1ba
commit b73f8a96ec

@ -3342,15 +3342,16 @@ def CMDbaseurl(parser, args):
def color_for_status(status):
"""Maps a Changelist status to color, for CMDstatus and other tools."""
BOLD = '\033[1m'
return {
'unsent': Fore.YELLOW,
'waiting': Fore.BLUE,
'reply': Fore.YELLOW,
'not lgtm': Fore.RED,
'lgtm': Fore.GREEN,
'commit': Fore.MAGENTA,
'closed': Fore.CYAN,
'error': Fore.WHITE,
'unsent': BOLD + Fore.YELLOW,
'waiting': BOLD + Fore.RED,
'reply': BOLD + Fore.YELLOW,
'not lgtm': BOLD + Fore.RED,
'lgtm': BOLD + Fore.GREEN,
'commit': BOLD + Fore.MAGENTA,
'closed': BOLD + Fore.CYAN,
'error': BOLD + Fore.WHITE,
}.get(status, Fore.WHITE)
@ -3724,7 +3725,9 @@ def CMDstatus(parser, args):
url += ' (broken)'
color = color_for_status(status)
reset = Fore.RESET
# Turn off bold as well as colors.
END = '\033[0m'
reset = Fore.RESET + END
if not setup_color.IS_TTY:
color = ''
reset = ''

Loading…
Cancel
Save