“This is the 17th day of my participation in the Gwen Challenge in November. See details of the event: The Last Gwen Challenge in 2021”.

preface

Jupyter Notebook is a popular interactive programming tool in Python, which is popular among data computing workers. Today, we will take a look at how to change the theme of Jupyter Notebook and make it our own.

Installing the Theme Package

Open a command prompt and execute the following code.

pip install jupyterthemes
Copy the code

usejt -hCheck out the help.usejt -lYou can view installed themes.

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

Choose a topic

You can change the installed theme using jT-t theme.

jt -t chesterish
Copy the code

Let’s take a look at the theme styles in 9 to provide a reference.

chesterish

grade3

gruvboxd

gruvboxd

monokai

oceans16

onedork

solarizedd

solarizedl

Other commands

In addition to jt-t specifying the theme, there are the following parameters to adjust the theme in more detail.

Description of command line options

  • Font of code: – f
  • Code font size: -fs (default: 11)
  • Notebook font: – nf
  • Notebook font size: -nfs (default: 13)
  • Text/MD cell font: – tf
  • Text/MD Cell font size-tfs (default: 13)
  • Pandas DF Fontsize-dfs (default: 9)
  • Output area font size: -ofS (default: 8.5)
  • Mathjax Font size (%)-mathfs (default: 100)
  • Introduce margins: -m (Default: auto)
  • The width of the cell: -cellw (default: 980)
  • Line height: -lineh (default: 170)
  • Width of the cursor: -cursw (default: 2)
  • Cursor color: – cursc
  • Alt prompts layout: – altp
  • Alt key Markdown background color: – altmd
  • Alt key output background color: – altout
  • Vim style: – vim
  • Toolbar visible: -t
  • The name and identity are visibleN: –
  • Mark is visible: – kl
  • Reset the default theme: – r
  • Enforce default fonts: – dfonts

For some of the above commands that have specific parameters, the possible values are listed below:

Code font (equal-width font) : -f parameter parameter list

anka anonymous aurulent bitstream bpmono code consolamono cousine dejavu droidmono fira firacode generic hack hasklig inconsolata inputmono iosevka liberation meslo office oxygen roboto saxmono source sourcemed ptmono ubuntu

Notebook font and Text/MD cell font (sans serif font) : -nf/-tf parameters

The list of parameters

opensans droidsans exosans latosans ptsans robotosans sourcesans

Notebook font and Text/MD cell font (serif font) : -nf/-tf parameters

The list of parameters

loraserif ptserif georgiaserif cardoserif crimsonserif ebserif merriserif neutonserif goudyserif

Order sample

Restoring the Default Theme

jt -r
Copy the code

The theme of the I

jt -t grade3 -f consolamono -fs 140 -altp -tfs 13 -nfs 115 -ofs 14 -cellw 80% -T
Copy the code

Analysis of the

  • jt -t chesterish: Choose skin (chesterish)
  • -f consolamono: Font for code (Consolamono)
  • -fs 140: Code font size (140)
  • -altpAlt prompt layout (default)
  • -tfs 13: Text/MD cell font size (13)
  • -nfs 115: Notebook font size (115)
  • -ofs 14: Output area font size (14)
  • -cellw 80%: Cell width (80%)
  • -T: Visible on the toolbar

The effect is as follows, personally feel good


This is what I want to share today. Search Python New Horizons on wechat, bringing you more useful knowledge every day. More organized nearly a thousand sets of resume templates, hundreds of e-books waiting for you to get oh!