From 85312dcef41f04adb19f151166951ffc8ecc441b Mon Sep 17 00:00:00 2001 From: Morten Enemark Lund Date: Tue, 1 Dec 2015 13:28:28 +0100 Subject: [PATCH] Tweak the prompt_toolkit colors to work better with black backgrounds. This is necessary since cmd.exe on windows only support a limited number of the colors, and prompt_toolkit tries to find the best match to these colors. --- xonsh/tools.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/xonsh/tools.py b/xonsh/tools.py index 139773f5f..66841e469 100644 --- a/xonsh/tools.py +++ b/xonsh/tools.py @@ -731,16 +731,26 @@ class FakeChar(str): RE_HIDDEN_MAX = re.compile('(\001.*?\002)+') -_PT_COLORS = {'BLACK': '#000000', - 'RED': '#FF0000', - 'GREEN': '#008000', - 'YELLOW': '#FFFF00', - 'BLUE': '#0000FF', - 'PURPLE': '#0000FF', - 'CYAN': '#00FFFF', - 'WHITE': '#FFFFFF', - 'GRAY': '#888888'} +_PT_COLORS_DARK = {'BLACK': '#000000', + 'RED': '#ff1010', + 'GREEN': '#00FF18', + 'YELLOW': '#FFFF00', + 'BLUE': '#0000D2', + 'PURPLE': '#FF00FF', + 'CYAN': '#00FFFF', + 'WHITE': '#FFFFFF', + 'GRAY': '#c0c0c0'} +_PT_COLORS_LIGHT = {'BLACK': '#000000', + 'RED': '#800000', + 'GREEN': '#008000', + 'YELLOW': '#808000', + 'BLUE': '#000080', + 'PURPLE': '#800080', + 'CYAN': '#008080', + 'WHITE': '#FFFFFF', + 'GRAY': '#008080'} + _PT_STYLE = {'BOLD': 'bold', 'UNDERLINE': 'underline', 'INTENSE': 'italic'} @@ -756,7 +766,7 @@ def _make_style(color_name): for k, v in _custom_colors.items(): if k in color_name: style.append(v) - for k, v in _PT_COLORS.items(): + for k, v in _PT_COLORS_DARK.items(): if k not in _custom_colors and k in color_name: style.append(v) return ' '.join(style)