How to Change Theme of Jupyter Notebook

You can change the default white theme of Jupyter notebook into one you like

The default theme of Jupyter notebook is white, and there is no menu, where we can change the theme. In this post, I will show you how to change the default theme into one that you might like.

1. Install jupyter-theme package

There is a package called jupyterthemes, which helps you to change the theme of Jupyter notebook. First, let’s install jupyter-theme package.

(1) From CMD, PowerShell, (Windows System) and Terminal (Windows, Linux and macOS), run the following command if you are classic Python users. If you are Anaconda user, use Anaconda Prompt, or Anaconda PowerShell instead on Windows system.

pip install jupyterthemes

(2) You can install this package directly in a code cell of Jupyter notebook.

!pip install jupyterthemes

(3) You can use the following command to upgrade it to latest version when there is a new version.

pip install — upgrade jupyterthemes

2. List the available themes in the package

After installing the package, you can use the following command to display the themes included in this package.

jt -l

Inside Jupyter notebook, you can use the following one.

!jt -l

From the above result, there are 9 available themes:
chesterish
grade3
gruvboxd
gruvboxl
monokai
oceans16
onedork
solarizedd
solarizedl

3. Change the theme

We can change them with the following command from either terminal, cmd, PowerShell or inside Jupyter notebook.

jt -t [themename]

or

jt -t [themename] -T

The difference between these two is that the first one makes toolbar unavailable. For example, let’s change theme to monokai.

(1) The first method

In terminal

jt -t monokai

Inside jupyter notebook

!jt -t monokai

For the first time to change the theme, we should restart the notebook. It only need to refresh the browser when changing the theme again.

You can see that the toolbar is missing with this method.

(2) The second method

In terminal

jt -t monokai -T

Inside Jupyter notebook

!jt -t monokai -T

Then refresh the browser of Jupyter notebook, you will see the toolbar. If you cannot see the toolbar, you need “Toggle the toolbar”. Just go to View, choose Toggle Toolbar.

4. Restore the original theme

If you want to come back to the default theme, just type the following command in the terminal, cmd, or PowerShell.

jt -r

You will see the following output:

Reset css and font defaults in:
C:\Users\sigmund\.jupyter\custom &
C:\Users\sigmund\AppData\Roaming\jupyter\nbextensions

That means you set back the theme successfully. After you refresh the browser, or restart Jupyter notebook, you will see the default white theme.

5. Video Version

If you like a video version of this post, please go to my YouTube channel to watch it. If it is helpful, please subscribe my channel to show your support.

6. Course

If you are interested in learning Jupyter notebook in details, you are welcome to enroll one of my course Practical Jupyter Notebook from Beginner to Expert.

Bookmark
ClosePlease login
0 - 0

Thank You For Your Vote!

Sorry You have Already Voted!

Please follow and like me:

Leave a Reply

Your email address will not be published. Required fields are marked *