# How to change the unreadable dark blue colour in the SageMath command line window under Windows-10?

I have just installed SageMath 8.7 on my Windows-10 laptop and want to learn it. The font colour of the prompt and of the typed numbers is dark blue on the black background, totally unreadable. Google search delivers tons of such complaints about bash/pythin/mintty/cygwin command lines. All suggest to edit some configuration files, which are hardly possible to locate in SageMath, neither in the SageMath installation directory, nor in my user home directory. There is a file ".sage\profile_default\ipython_config.py" in my Windows home, containing the line c.TerminalInteractiveShell.colors = 'Linux' Changing this line has no effect.

edit retag close merge delete

There appears to be a bug, because the default color scheme that's supposed to be installed (albeit still a dark scheme) is supposed to be much more readable. Apparently it's not getting installed though.

( 2019-07-12 14:09:32 +0200 )edit

If it is bug, then it is also a bug already in mintty. I tried mintty last year with cygwin (without SageMath) and gave up because of this issue. Some software products follow a principle "never use our default setting".

( 2019-07-12 14:40:32 +0200 )edit

Sort by » oldest newest most voted

This is because the default color scheme in Sage is adapted to a light background, while Sage-Windows starts on dark background.

There is an "ipython magic" that allows to choose the color scheme for syntax highlighting.

At the Sage prompt, type:

sage: %colors Linux


To make that permanent, add that line to your init.sage file, which is read each time Sage starts.

more

Thank you, this works. Which other color schemes are available in addition to "Linux"? A remaining cosmetic inconvenience is the parrot-like look of the command-line window. I typed a wrong command x:=2 and got a message error. This short dialog occupied just 5 lines, but had 8 different colors! Though I am not a friend of 50 shades of black, but this default multi-coloring is an opposite extremity. Is any reasonable compromise available?

( 2019-07-12 14:51:02 +0200 )edit

colors is IPython magic and their documentation says

Currently implemented schemes: NoColor, Linux, LightBG.

( 2019-07-14 10:51:41 +0200 )edit

The Windows installer is supposed to come with the "Linux" color scheme pre-selected, which is more readable on a dark background.

It looks like there is a bug in the installer. The file you found .sage\profile_default\ipython_config.py is the right file, but it's in the wrong location. It should be under .sage\ipython-5.0.0\profile_default\ipython_config.py.

Incidentally Sage 8.8 for Windowswas just released yesterday, and I confirmed that it has the same bug. I am working on creating a new release now, but in the meantime you can move the file I mentioned to the correct location and play around with your color scheme there. Some of the available default color schemes for the IPython terminal interface are given at: https://ipython.readthedocs.io/en/sta...

It's worth noting also that dealing with colors in the console can be tricky. Most colors schemes won't change your background, for example, and are designed for either a dark background or a light background in mind. It's also tricky because the way colors work is that the application outputs specific color codes to the terminal, and it's up to the terminal program to decide how to interpret those colors.

Sage for Windows (which is based on Cygwin), includes the MinTTY terminal, a terminal emulator for Cygwin. You can change the color settings by right-clicking on the window's title bar, and selection Options. From there you can change things such as your background color.

more

New Sage user here. The blue-on-black color scheme also bothered me. Thought I should provide more information.

Based on what I read here, I tried %colors:

sage: %colors


and got

UsageError: %colors: you must specify a color scheme. See '%colors?'


So I tried %colors?

sage: %colors?
Docstring:
Switch color scheme for prompts, info system and exception handlers.

Currently implemented schemes: NoColor, Linux, LightBG.

Color scheme names are not case-sensitive.

To get a plain black and white terminal:

%colors nocolor
File:      ~/<decorator-gen-35>


Great, we can set a color scheme in Sage like this:

%colors Linux


If you want this to run every time you use Sage, add that command to your init.sage file.

Because I am on Linux, I created init.sage in the .sage directory in my user home: \$HOME/.sage/init.sage

Read more in the Sage manual section "Sage startup scripts."

Also note that there might be more color schemes than those listed under %colors? ...

I misspelled the color scheme argument to %colors and noticed the following in the resulting "Unrecognized color scheme" error output:

Valid schemes: ['NoColor', 'Linux', 'LightBG', 'Neutral', '']


So "Neutral" is another valid option, despite being unmentioned by %colors?. Hope this helps other newbies!

more