How to change default colour scheme for ipython notebook?
Asked Answered
W

3

6

Is there an easy way to change this? I've just upgraded from ipython notebook v0.12 to 1.1 and it doesn't seem too bad so far but these colours are killing me. I've been working for an hour now and because it's so bright my eyes are starting to hurt. Any advice would be great (other than turning down the brightness of my computer screen...)

Wormy answered 21/2, 2014 at 4:43 Comment(3)
put on a pair of sunglasses ;PRepercussion
This doesn't at all answer your question, but f.lux is a lifesaver.Eiland
@JesseMu just be joking, btw, f.lux is not quite suitable to use ;Repercussion
A
5

Notice

The answer below pertains to the old IPython notebook. For the new Jupyter Notebook, please see this other answer.

Historical answer

As User mentioned in his answer, you need to modify the CSS of the notebook.

Fortunately others have already done the hard work for you, so if you search for "IPython themes" you'll find pages like Nikhil Sonnad's, with pre-packaged CSS themes for IPython notebooks.

Please read the page above in detail before using the themes, specially the detail that his themes do away with the toolbar (and how to get it back), but I'll paraphrase his instructions here, assuming that you want your IPython (version 3) notebook to use the ocean-dark theme, that you're running bash as your shell and that you have wget installed:

ipython profile create ocean-dark
wget -O `ipython locate profile ocean-dark`/static/custom/custom.css \
      https://github.com/nsonnad/base16-ipython-notebook/raw/master/ipython-3/output/base16-ocean-dark.css

Now, to run your IPython notebook with the ocean-dark theme, do

ipython notebook --profile=ocean-dark

Notice that there is no need to match the name of the theme with the name of the profile like in my example. You could do that in your own pre-existing profiles, or even in the default profile, by leaving out the profile name in the ipython locate command above.

Astro answered 16/6, 2015 at 13:47 Comment(6)
I believe it should be ipython profile create ocean-dark not ipython create profile ocean-darkPollinize
@spamduck: Thanks! Fixed.Astro
This style removes the buttons from the notebook.Okeefe
@Luis: comment the line that removes the toolbarHester
Note that jupyter notebook now has a different system, (the one involving pip install) so the above doesn't apply / didn't work for meSheepwalk
@orangenarwhals, I've added a note to my answer clarifying that it applies to the old IPython noteboo, and a link to an answer appropriate to Jupyter notebook.Astro
U
2

I think you need to modify the CSS of the page. Therefore you can return html.

Have a look at: http://catherinedevlin.blogspot.de/2013/06/easy-html-output-in-ipython-notebook.html

It could also be that there is a special HTML() object.

Uno answered 21/2, 2014 at 10:52 Comment(0)
T
2

i personally use "invert page color" to change white background to dark background. (it is google chrome extension)

invert page color is a google extension which helps to invert page color.before using invert page color

after using invert page color

Toffic answered 6/4, 2016 at 15:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.