Fix highlighted text not readable with some color schemes

Make the foreground (text) color be the usual background color,
when highlighting text. This is done by setting the foreground
color instead of the background color, then inverting (code 7)
to swap the foreground and background colors.

Previously, with some color schemes there was not enough contrast
between the text and highlight color.
Based on the assumption that there should be contrast between
terminal colors and the background, this should make the text
readable with a wider set of color schemes.
This commit is contained in:
Rob Broadley 2025-01-06 18:40:26 +00:00
parent 86300a4a7e
commit b6c3bf3763
No known key found for this signature in database
GPG key ID: 8EFDB195479FB960

View file

@ -56,10 +56,10 @@ if sys.platform == 'win32': # pragma: no cover (windows)
else: # pragma: win32 no cover
terminal_supports_color = True
RED = '\033[41m'
GREEN = '\033[42m'
YELLOW = '\033[43;30m'
TURQUOISE = '\033[46;30m'
RED = '\033[31;7m'
GREEN = '\033[32;7m'
YELLOW = '\033[33;7m'
TURQUOISE = '\033[36;7m'
SUBTLE = '\033[2m'
NORMAL = '\033[m'