change the default theme in Jupyter Notebook

How to change the default theme in Jupyter Notebook ?

This tutorial guides you on how to change the default theme in Jupyter Notebook. After you install and run jupyter notebook from the command line or terminal, the notebook server will get started and you should see notebook open in a browser as shown below.

Default theme in Jupyter Notebook

After notebook opens in the default browser, you will see the Notebook Dashboard which will show list of notebooks, files and other subdirectories in the directory. If you click the notebook file (.ipynb) it will start running in new tab. The default theme will look like below.

 change the default theme in Jupyter Notebook

 

Let’s see how to change this default theme to some other theme.

Change the default theme in Jupyter Notebook

First, I tried to list available jupyter themes, by running the following jt command.

> jt -l

'jt' is not recognized as an internal or external command,
operable program or batch file.

But, it resulted with error: ‘jt’ is not recognized as an internal or external command.

Therefore, you need to install jupyterthemes package with pip install command as shown below.

For example,

> pip install jupyterthemes
Collecting jupyterthemes Downloading jupyterthemes-0.20.0-py2.py3-none-any.whl (7.0 MB) |████████████████████████████████| 7.0 MB 1.3 MB/s Requirement already satisfied: jupyter-core in c:\users990\appdata\local\programs\python\python38-32\lib\site-packages (from jupyterthemes) (4.7.1) Requirement already satisfied: notebook>=5.6.0 in c:\users990\appdata\local\programs\python\python38-32\lib\site-packages (from jupyterthemes) (6.3.0) Collecting lesscpy>=0.11.2 Downloading lesscpy-0.14.0-py2.py3-none-any.whl (46 kB) |████████████████████████████████| 46 kB 1.2 MB/s Collecting matplotlib>=1.4.3 Downloading matplotlib-3.4.1-cp38-cp38-win32.whl (7.0 MB) |████████████████████████████████| 7.0 MB 172 kB/s ------- ------- Successfully installed cycler-0.10.0 jupyterthemes-0.20.0 kiwisolver-1.3.1 lesscpy-0.14.0 matplotlib-3.4.1 numpy-1.20.2 pillow-8.2.0 ply-3.11

Once jupyterthemes is installed, you can check available themes using the same jt command.

> jt -l
Available Themes: chesterish grade3 gruvboxd gruvboxl monokai oceans16 onedork solarizedd solarizedl

For instance, you can choose one of the theme. Let’s say you would like to change the default one to solarizedd. You can change the theme by running the following command.

> jt -t solarizedd

Once the new theme is applied. You need to restart the notebook server. What I did was, I just shutdown and started the notebook server again.

> python -m notebook

After the notebook server started, it will open the notebook interface with the new theme applied as shown below.

change the theme in Jupyter Notebook

 

That’s it. You had learnt how to change default theme in Jupyter Notebook.

Note, to reset theme back to default one, please check How to reset theme to default theme.

Hope it helped 🙂

You’ll also like:

References

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments