Ask Your Question
4

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

asked 2019-07-12 12:59:10 +0100

Sevas gravatar image

updated 2023-01-09 23:59:51 +0100

tmonteil gravatar image

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 flag offensive close merge delete

Comments

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.

Iguananaut gravatar imageIguananaut ( 2019-07-12 14:09:32 +0100 )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".

Sevas gravatar imageSevas ( 2019-07-12 14:40:32 +0100 )edit

3 Answers

Sort by ยป oldest newest most voted
4

answered 2019-07-12 13:03:52 +0100

slelievre gravatar image

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.

edit flag offensive delete link more

Comments

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?

Sevas gravatar imageSevas ( 2019-07-12 14:51:02 +0100 )edit

colors is IPython magic and their documentation says

Currently implemented schemes: NoColor, Linux, LightBG.
vdelecroix gravatar imagevdelecroix ( 2019-07-14 10:51:41 +0100 )edit
2

answered 2019-07-12 14:57:51 +0100

Iguananaut gravatar image

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.

edit flag offensive delete link more
2

answered 2020-07-08 15:27:32 +0100

askbot_throwaway123 gravatar image

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!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2019-07-12 12:59:10 +0100

Seen: 4,047 times

Last updated: Jul 08 '20