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>
diff --git a/git_cl.py b/git_cl.py
index 2f28fe3..d1cdac0 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -3342,15 +3342,16 @@
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 @@
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 = ''