23

I recently updated to the most recent version of JupyterLab (0.28.12). I'm on Windows.

I've tried adjusting the variables.css file located in \Lib\site-packages\jupyterlab\themes\@jupyterlab\theme-light-extension of my Miniconda/Anaconda folder. I mainly want to change the font family and size, which I've tried using the variables.css file. However, I can't see any changes.

I went to the extreme point of deleting both theme folders, but still I can change themes without a problem through the Lab interface.

Where are the JupyterLab theme .css files located? Or how can I find them? I've searched for css files and the themes sub folder seems to be the only location for them. I can't seem to find any in my user directory either c:\Users\User\.jupyter where the .css files were for Jupyter Notebook were located.

Thanks!

yohfdo
  • 353
  • 1
  • 3
  • 7

7 Answers7

25

I am running version 0.35.4 right now on Ubuntu and it is possible to edit the fonts in the Settings->Advanced Settings Editor, selected from the top bar menu.

There are a number of options that can be set by changing the json strings in the Raw View. See the picture below:

enter image description here

Vince W.
  • 3,561
  • 3
  • 31
  • 59
8

I'm on ubuntu, so probably have to adapt for windows. The fonts for cell-editing are available in the UI as noted by @vince-w. I just copied over a minimal set to my user settings.

{
    "codeCellConfig": {
        "fontFamily": "DejaVu Sans Mono",
        "fontSize": 15,
        "lineHeight": 1.2,
    },
    "markdownCellConfig": {
        "fontFamily": "M+ 2p",
        "fontSize": 16,
        "lineHeight": 1.2,
    },
    "rawCellConfig": {
        "fontFamily": "M+ 2p",
        "fontSize": 16,
        "lineHeight": 1.2,
    }
}

All good, except for the rendered markdown in the notebook. To fix that I found the css file in my conda env and modified it directly. Pretty much what @苗晧宇 noted. Change path for light/dark.

$HOME/anaconda3/envs/YOUR_ENV_NAME_HERE/share/jupyter/lab/themes/@jupyterlab/theme-dark-extension/index.css

  /*                       vvvv changed from 14px  */
  --jp-content-font-size1: 16px; /* Base font size */

  /*                        vvvv inserted at the front  */
  --jp-content-font-family: 'M+ 2p', -apple-system, BlinkMacSystemFont, 'Segoe UI',

I tried creating a copy of that index.css file at $HOME/.jupyter/lab/themes/@jupyterlab/theme-dark-extension/index.css, but it was ignored by jupyterlab.

volante
  • 154
  • 2
  • 8
8

It is now possible to change the font sizes of most elements of the interface via the Settings menu .e.g: Settings->JupyterLab Theme->Increase Code Font Size etc.

Note: These do not change if View->Presentation Mode is ticked.

To change the font style one still needs to go to Settings->Advanced Settings Editor (as mentioned in other answers) - and one can also changes font sizes there - which will take effect even if Presentation Mode is enabled.

Pierz
  • 7,064
  • 52
  • 59
5

From http://jupyterlab.readthedocs.io/en/latest/user/extensions.html?highlight=themes :

  • The themes directory contains assets (such as CSS and icons) for JupyterLab theme extensions.
  • The themes directory is located in the JupyterLab application directory which defaults to <sys-prefix>/share/jupyter/lab, where <sys-prefix> is the site-specific directory prefix of the current Python environment. You can query the current application path by running jupyter lab path.
drlee
  • 81
  • 2
  • 5
  • Thanks. It worked for me. I was looking for a way to change font size but the two options i found are: change it current theme or create new custom theme. – Dmytro Biletskyi Mar 24 '18 at 18:12
  • 1
    I believe now there are options to change the `font-family` and `font-size` in the Advanced settings? – yohfdo Aug 02 '18 at 05:39
  • 1
    is there any settings for terminal fonts, can't seem to find it anywhere – canonball May 31 '19 at 12:46
1

Jupyter deskotp version latest 3.6.1 .

enter image description here

enter image description here

enter image description here

Vy Do
  • 46,709
  • 59
  • 215
  • 313
0

You should change the font size in the website. It should be at Settings->Fonts->Code->Size for code editor and Settings->Fonts->Content->Size for main contents The css file should be <prefix>/share/jupyter/lab/themes/@jupyterlab/<your theme>/index.css. To change the font, find all the place in the css file which looks like setting font, and change it.

苗晧宇
  • 1
  • 1
0

For increasing the font size on JupyterLabs:

  1. Click: Settings > Theme > Increase Code Font Size