diff --git a/IPython/core/excolors.py b/IPython/core/excolors.py index d979a71..487bde1 100644 --- a/IPython/core/excolors.py +++ b/IPython/core/excolors.py @@ -3,6 +3,7 @@ Color schemes for exception handling code in IPython. """ +import os import warnings #***************************************************************************** @@ -155,6 +156,12 @@ def exception_colors(): Normal = C.Normal, )) + # Hack: the 'neutral' colours are not very visible on a dark background on + # Windows. Since Windows command prompts have a dark background by default, and + # relatively few users are likely to alter that, we will use the 'Linux' colours, + # designed for a dark background, as the default on Windows. + if os.name == "nt": + ex_colors.add_scheme(ex_colors['Linux'].copy('Neutral')) return ex_colors diff --git a/IPython/terminal/interactiveshell.py b/IPython/terminal/interactiveshell.py index 96f33cb..97fabdb 100644 --- a/IPython/terminal/interactiveshell.py +++ b/IPython/terminal/interactiveshell.py @@ -286,6 +286,16 @@ class TerminalInteractiveShell(InteractiveShell): Token.OutPrompt: '#990000', Token.OutPromptNum: '#ff0000 bold', }) + + # Hack: Due to limited color support on the Windows console + # the prompt colors will be wrong without this + if os.name == 'nt': + style_overrides.update({ + Token.Prompt: '#ansidarkgreen', + Token.PromptNum: '#ansigreen bold', + Token.OutPrompt: '#ansidarkred', + Token.OutPromptNum: '#ansired bold', + }) elif legacy =='nocolor': style_cls=_NoStyle style_overrides = {}