Tip: Dark mode for Jupyter Notebooks

If this was an article it would be entitled Theming Jupyter notebook. However, since it falls in the tip category, I'll make it short hence the current title.

Jupyter makes code writing interactive and allows you to publish as you would an article. You can teach with it, learn on it and publish a notebook/s on several platforms like GitHub and Google Colab (examples linked).

A notebook is usually plain white like this:

Installation

After going through the installation guide here, run pip install jupyterthemes and jt -t onedork (in the same virtual environment) before starting the notebook.

The complete list of commands to run in your terminal or command prompt:

pip install jupyter
pip install jupyterthemes
jt -t onedork
jupyter notebook

Then click on the link in the output starting with the following: http://localhost:8888/?token= ...

Before:

plain-jupyter-theme

plain-jupyter-theme

After:

jupyter-dark-mode

jupyter-dark-mode

To reset, simply kill the server, Ctrl+C, then run jt -r. Run jt -l to get a list of other themes. More details are on the jupyter-themes' GitHub page.


S/O to Jee, the Whimsical software engineer who has been a colleague for almost 4 years for this tip.

This gist for All things Python has proved useful over time for me; help yourself to it. Feedback is welcome.

Catch more tips here.