Change the Theme in Jupyter Notebook?
I like dark themes. However, the default theme of Jupyter notebooks is light, and I can't find the option to change the theme/background-color. How is this done?
Solution 1:
This is easy to do using the jupyter-themes
package by Kyle Dunovan. You may be able to install it using conda
. Otherwise, you will need to use pip
.
Install it with conda:
conda install -c conda-forge jupyterthemes
or pip:
pip install jupyterthemes
You can get the list of available themes with:
jt -l
So change your theme with:
jt -t theme-name
To load a theme, finally, reload the page. The docs and source code are here.
Solution 2:
Follow these steps
Install jupyterthemes with pip:
pip install jupyterthemes
Then Choose the themes from the following and set them using the following command, Once you have installed successfully, Many of us thought we need to start the jupyter server again, just refresh the page.
Set the theme with the following command:
jt -t <theme-name>
Available themes:
- onedork
- grade3
- oceans16
- chesterish
- monokai
- solarizedl
- solarizedd
Screens of the available themes are also available in the Github repository.
Solution 3:
After I changed the theme it behaved strangely. The font size was small, cannot see the toolbar and I really didn't like the new look.
For those who want to restore the original theme, you can do it as follows:
jt -r
You need to restart Jupyter the first time you do it and later refresh is enough to enable the new theme.
or directly from inside the notebook
!jt -r
Solution 4:
Instead of installing a library inside Jupyter, I would recommend you use the 'Dark Reader' extension in Chrome (you can find 'Dark Reader' extension in other browsers, e.g. Firefox). You can play with it; filter the URL(s) you want to have dark theme, or even how define the Dark theme for yourself. Below are couple of examples:
I hope it helps.