개발

[jupyter] jupyterthemes로 jupyter notebook 테마 설정하기

Fine애플 2021. 8. 29. 23:17

jupyterthemes로 테마 설정하는 방법을 정리하고자 한다.

 

1. jupyterthemes 설치

pip install jupyterthemes

 

2. jupyterthemes 사용하기

1) 테마 리스트 보기

jt -l

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

 

2) 테마 변경하기

테마를 변경하기 위해서는 아래 코드를 terminal이나 jupyter notebook에서 실행시켜주고, 반드시 jupyter를 껐다가 다시 실행시켜야 한다.

# terminal에서 실행 시
jt -t onedork

# jupyter notebook에서 실행 시
!jt -t onedork

 

3) 기타 설정

jupyterthemes의 다른 설정들로 메뉴바, notebook 이름 보이기 등을 설정할 수가 있다. 먼저 jt -h으로 어떤 설정들이 있는지 확인해보자

jt -h

>>>>  -l, --list            list available themes
      -t THEME, --theme THEME
                            theme name to install
      -f MONOFONT, --monofont MONOFONT
                            monospace code font
      -fs MONOSIZE, --monosize MONOSIZE
                            code font-size
      -nf NBFONT, --nbfont NBFONT
                            notebook font
      -nfs NBFONTSIZE, --nbfontsize NBFONTSIZE
                            notebook fontsize
      -tf TCFONT, --tcfont TCFONT
                            txtcell font
      -tfs TCFONTSIZE, --tcfontsize TCFONTSIZE
                            txtcell fontsize
      -dfs DFFONTSIZE, --dffontsize DFFONTSIZE
                            pandas dataframe fontsize
      -ofs OUTFONTSIZE, --outfontsize OUTFONTSIZE
                            output area fontsize
      -mathfs MATHFONTSIZE, --mathfontsize MATHFONTSIZE
                            mathjax fontsize (in %)
      -m MARGINS, --margins MARGINS
                            fix margins of main intro page
      -cursw CURSORWIDTH, --cursorwidth CURSORWIDTH
                            set cursorwidth (px)
      -cursc CURSORCOLOR, --cursorcolor CURSORCOLOR
                            cursor color (r, b, g, p)
      -cellw CELLWIDTH, --cellwidth CELLWIDTH
                            set cell width (px or %)
      -lineh LINEHEIGHT, --lineheight LINEHEIGHT
                            code/text line-height (%)
      -altp, --altprompt    alt input prompt style
      -altmd, --altmarkdown
                            alt markdown cell style
      -altout, --altoutput  set output bg color to notebook bg
      -P, --hideprompt      hide cell input prompt
      -T, --toolbar         make toolbar visible
      -N, --nbname          nb name/logo visible
      -kl, --kernellogo     kernel logo visible
      -vim, --vimext        toggle styles for vim
      -r, --reset           reset to default theme
      -dfonts, --defaultfonts
                            force fonts to browser default

 

폰트 사이즈는 그냥 화면 확대/축소를 사용하는게 편해서 메뉴와 notebook 이름이 보이도록 아래와 같은 설정으로 사용중이다. 그럼 아래 사진과 같은 테마가 적용된다.

jt -t onedork -N -T

728x90