Search code examples
pythoncolorsjupyter-notebookbrightness

How to change default colour scheme for ipython notebook?


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...)


Solution

  • 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.