Jupyter Notebook Dark Mode: A Step-by-Step Guide

Learn how to enable dark mode in Jupyter Notebook with this step-by-step guide. Improve your productivity and reduce eye strain with this simple process.

As a data scientist, you probably spend a lot of time working in Jupyter Notebook. It’s a powerful tool for interactive computing and data analysis. But if you’re like me, you might find the default white background a bit harsh on the eyes, especially if you’re working late into the night. That’s where dark mode comes in. In this post, we’ll take a look at how to enable dark mode in Jupyter Notebook. One of the internet’s best kept secrets is that you can use Jupyter notebooks for free at Saturn Cloud.

Love working in dark mode? With Saturn Cloud, switching your Jupyter Notebooks to dark mode is quick and easy. Request a free demo to learn more. and enjoy a user-friendly data science environment.

Table of Contents

  1. Step 1: Install the Jupyter Themes Extension
  2. Step 2: Choose a Dark Theme
  3. Step 3: Customize the Theme
  4. Step 4: Reset to Default
  5. Recommended themes and options
  6. Customization options
  7. Conclusion

Step 1: Install the Jupyter Themes Extension

The first step is to install the Jupyter Themes extension. This is a third-party extension that allows you to customize the look and feel of Jupyter Notebook. To install the extension, open a terminal or command prompt and run the following command:

pip install jupyterthemes

Step 2: Choose a Dark Theme

Once you’ve installed the extension, you can choose a dark theme by running the following command in your terminal:

jt -t <theme-name>

Replace <theme-name> with the name of the dark theme you want to use. There are several dark themes to choose from, including:

Available Themes:
   chesterish
   grade3
   gruvboxd
   gruvboxl
   monokai
   oceans16
   onedork
   solarizedd
   solarizedl

For example, if you want to use the onedork theme, you would run the following command:

jt -t oceans16

Alt text

Step 3: Customize the Theme

If you want to further customize the theme, you can use the following command:

jt -t <theme-name> -f <font-name> -fs <font-size>

Replace <font-name> with the name of the font you want to use, and <font-size> with the font size you want to use. For example, if you want to use the onedork theme with the Roboto font at a font size of 14, you would run the following command:

jt -t onedork -f roboto -fs 14

Step 4: Reset to Default

If you want to reset the theme back to the default, you can use the following command:

jt -r

This will reset the theme back to the default Jupyter Notebook theme.

If you’re well-acquainted with the default theme, encompassing the font size, menu tab placement, and screen layout, and yet desire to adopt a dark theme, we recommend the following configuration.

jt -t onedork -fs 115 -nfs 125 -tfs 115 -dfs 115 -ofs 115 -cursc r -cellw 80% -lineh 115 -altmd  -kl -T -N

Let’s break down the details of the command above:

-fs 115: Code font size

-nfs 125: Notebook menu font size

-tfs 115: Markdown font size

-dfs 115 : pandas DataFrame font size

-ofs 115: Output area font size

-cursc r: cursor color red (red seems to be the most noticeable in onedork theme)

-cellw 80%: Cell width 80% (the larger the number, the fuller the screen)

-lineh 115 : code line spacing

-altmd: Option to make the background of Markdown cells transparent.

-kl: Display the kernel logo (python logo in the upper right corner of the laptop screen)

-T: Display toolbar under menu tab (save, add/delete/move cell, stop/restart kernel, etc.)

-N: Display file name on laptop screen

By refreshing the notebook, your notebook will look like this:

Alt text

Alt text

Customization options

Command Line Usage

jt  [-h] [-l] [-t THEME] [-f MONOFONT] [-fs MONOSIZE] [-nf NBFONT]
    [-nfs NBFONTSIZE] [-tf TCFONT] [-tfs TCFONTSIZE] [-dfs DFFONTSIZE]
    [-m MARGINS] [-cursw CURSORWIDTH] [-cursc CURSORCOLOR] [-vim]
    [-cellw CELLWIDTH] [-lineh LINEHEIGHT] [-altp] [-altmd] [-altout]
    [-P] [-T] [-N] [-r] [-dfonts]

Description of Command Line options

cl optionsargdefault
Usage help-h
List Themes-l
Theme Name to Install-t
Code Font-f
Code Font-Size-fs11
Notebook Font-nf
Notebook Font Size-nfs13
Text/MD Cell Font-tf
Text/MD Cell Fontsize-tfs13
Pandas DF Fontsize-dfs9
Output Area Fontsize-ofs8.5
Mathjax Fontsize (%)-mathfs100
Intro Page Margins-mauto
Cell Width-cellw980
Line Height-lineh170
Cursor Width-cursw2
Cursor Color-cursc
Alt Prompt Layout-altp
Alt Markdown BG Color-altmd
Alt Output BG Color-altout
Style Vim NBExt*-vim
Toolbar Visible-T
Name & Logo Visible-N
Kernel Logo Visible-kl
Reset Default Theme-r
Force Default Fonts-dfonts

Love working in dark mode? With Saturn Cloud, switching your Jupyter Notebooks to dark mode is quick and easy. Request a free demo to learn more. and enjoy a user-friendly data science environment.

Conclusion

Enabling dark mode in Jupyter Notebook is a simple process that can make a big difference in your productivity. By following the steps outlined in this post, you can customize the look and feel of Jupyter Notebook to suit your needs. Whether you’re working late into the night or just prefer a darker color scheme, dark mode is a great option to consider.


About Saturn Cloud

Saturn Cloud is your all-in-one solution for data science & ML development, deployment, and data pipelines in the cloud. Spin up a notebook with 4TB of RAM, add a GPU, connect to a distributed cluster of workers, and more. Request a demo today to learn more.