From 1fe475a3d6b1f120edc5b29c32cb3422a209c397 Mon Sep 17 00:00:00 2001 From: Morten Enemark Lund Date: Sun, 17 Apr 2016 21:48:07 +0200 Subject: [PATCH 1/2] Aligns the colors with prompt_toolkit specification of colors when working on windows --- xonsh/pyghooks.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xonsh/pyghooks.py b/xonsh/pyghooks.py index c4e3f1816..df767b719 100644 --- a/xonsh/pyghooks.py +++ b/xonsh/pyghooks.py @@ -539,6 +539,29 @@ if hasattr(pygments.style, 'ansicolors'): Color.WHITE: '#ansiwhite', Color.YELLOW: '#ansiyellow', } +elif ON_WINDOWS: + # These colors must match the color specification + # in prompt_toolkit, so the colors are converted + # correctly + DEFAULT_STYLE = { + Color.BLACK: '#000000', + Color.BLUE: '#0000AA', + Color.CYAN: '#00AAAA', + Color.GREEN: '#00AA00', + Color.INTENSE_BLACK: '#444444', + Color.INTENSE_BLUE: '#4444FF', + Color.INTENSE_CYAN: '#44FFFF', + Color.INTENSE_GREEN: '#44FF44', + Color.INTENSE_PURPLE: '#FF44FF', + Color.INTENSE_RED: '#FF4444', + Color.INTENSE_WHITE: '#888888', + Color.INTENSE_YELLOW: '#FFFF44', + Color.NO_COLOR: 'noinherit', + Color.PURPLE: '#AA00AA', + Color.RED: '#AA0000', + Color.WHITE: '#FFFFFF', + Color.YELLOW: '#AAAA00', + } else: DEFAULT_STYLE = { Color.BLACK: '#000000', From 6bd02978af374f7b7b71f2c40101c46772bb7f8b Mon Sep 17 00:00:00 2001 From: Morten Enemark Lund Date: Wed, 20 Apr 2016 12:04:10 +0200 Subject: [PATCH 2/2] Don't fix colors when using ConEmu --- xonsh/pyghooks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xonsh/pyghooks.py b/xonsh/pyghooks.py index df767b719..5de48a30f 100644 --- a/xonsh/pyghooks.py +++ b/xonsh/pyghooks.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- """Hooks for pygments syntax highlighting.""" +import os import re import string import builtins @@ -539,10 +540,10 @@ if hasattr(pygments.style, 'ansicolors'): Color.WHITE: '#ansiwhite', Color.YELLOW: '#ansiyellow', } -elif ON_WINDOWS: +elif ON_WINDOWS and 'CONEMUANSI' not in os.environ: # These colors must match the color specification # in prompt_toolkit, so the colors are converted - # correctly + # correctly when using cmd.exe DEFAULT_STYLE = { Color.BLACK: '#000000', Color.BLUE: '#0000AA',