Ask Your Question
7

sage terminal colors

asked 2013-04-24 14:17:36 +0100

kjlvcxzoiperwq gravatar image

updated 2015-01-14 11:46:53 +0100

FrédéricC gravatar image

I just upgraded from sage version 4.8 to version 5.8. I was pleasantly surprised to see colouring of the text similar to ipython does. However, sage seems to be defaulting to colours geared towards white background and black text. I have a black background and white text. The default colour scheme is very hard to read and I can't figure out how to change it. I did find this web page (http://mvngu.wordpress.com/2009/05/21...) but following the instructions in it does not work and my sage colour scheme is always that of figure 3 on the link, but my system terminal settings have a black background and white text. Although I would prefer the right colour scheme, the old pure black and white would be better than what I have now. How can I change the sage terminal colours to something more readable? I don't want to change my default system terminal settings.

I can type "%colors Linux" once I launch sage and it does then give me the colour scheme that I want, but I can't get the scheme to persist from session to session.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
12

answered 2013-04-24 14:46:31 +0100

fidbc gravatar image

You can try adding the line

%colors Linux

to the file $HOME/.sage/init.sage, that will make sage execute that command automatically at startup (taken from the sage FAQ).

edit flag offensive delete link more

Comments

2

That worked. The file init.sage didn't exist so I had to create it myself.

kjlvcxzoiperwq gravatar imagekjlvcxzoiperwq ( 2013-04-24 14:52:43 +0100 )edit
4

answered 2016-12-16 18:15:42 +0100

Sébastien gravatar image

Open the file profile_default/ipython_config.py inside the folder given by the command sage -ipython locate (if you do not have this file, sage -ipython profile create creates it). In that file, uncommenting the following line will set the default color properly:

# Set the color scheme (NoColor, Neutral, Linux, or LightBG).
c.InteractiveShell.colors = 'Linux'     # Linux is for dark background
edit flag offensive delete link more

Comments

This has an advantage over adding %colors Linux to one's init.sage file:

  • loading one's init.sage file in a Jupyter sheet with

    load(sage.env.SAGE_STARTUP_FILE)
    

    results in an error if it contains any IPython line magic such as %colors Linux.

I realised this while trying to answer

slelievre gravatar imageslelievre ( 2021-05-14 19:47:30 +0100 )edit
3

answered 2016-12-13 09:09:40 +0100

Daniel Krenn gravatar image

FYI, %colors offers NoColor, Linux and LightBG.

edit flag offensive delete link more

Comments

Is it possible to customize the schemes?

nsirolli gravatar imagensirolli ( 2017-01-12 19:51:02 +0100 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-04-24 14:17:36 +0100

Seen: 15,510 times

Last updated: Dec 16 '16