21 Apr 2014 #python

IPython extension to toggle dark code cells

Update 25 August 2014: As described in this newer post, this is now part of the ipython-extensions repository.

Sometimes it’s more pleasant to read light text on a dark background, particularly when dealing with code. However, depending on ambient lighting, it can be necessary to switch back to dark text on a light background on short notice.

To make this possible, I created a simple extension for the IPython notebook (version 2.0 and above). It adds a button to the toolbar that toggles between a light (default) and dark display mode for code cells in the notebook, with an optional keyboard shortcut.

This turns

Light IPython Notebook

into

Dark IPython Notebook

Details and installation instructions are in the GitHub repository.