How to Apply Theme to Jupyter Lab

How to apply theme to jupyter lab

UPDATE 02/03/2018
Now this option is already built in in the settings menu!

Sample Image

Recently this issue was closed on the GitHub, and finally it is possible to edit settings of the jupyter lab. Hurray!

The procedure is described in this pull request.

Just update your jupyter-lab (now it is version 0.27.0) and go to File - Settings, then select Theme tab. And type your theme name in the User Overrides and press the check-mark at the right of the string. I tried several, but only "theme": "JupyterLab Dark" seems to work. Enough for me.

Apply dark theme to jupyter lab

Sample Image

I really appreciate the work the jupyter team is doing. Thank you all!

Change the Theme in Jupyter Notebook?

This is easy to do using the jupyter-themes package by Kyle Dunovan. You may be able to install it using conda. Otherwise, you will need to use pip.

Install it with conda:

conda install -c conda-forge jupyterthemes

or pip:

pip install jupyterthemes

You can get the list of available themes with:

jt -l

So change your theme with:

jt -t theme-name

To load a theme, finally, reload the page. The docs and source code are here.

How to edit a JupyterLab theme

To edit JupypterLab themes you need to make changes to the file variables.css which is located in jupyterlab/packages/[THEME NAME]/style/

You can inspect the element of the JupyterLab that you'd like to change to find out its class. I used Chrome DevTools ctrl+shift+i and click on various div classes until I found the one I wanted to alter.

Once you have the name of the div class you'd like to customize, add the changes to the variables.css file. Here's what I changed and the result.

.jp-RenderedImage {
background-color: #A4A4A4
}

Change background of figures to grey to allow axis to be read

You can use this gist (where the code in the first cell comes from) created by one of the JupyterLab contributors to experiment with changes you made to the variables.css file.

How to edit jupyter lab theme

we are using version 0.35.x ...
the following steps worked for me ... it will create a clone of the light theme, would install it in jupyter lab and you would be able to select that from settings menu. you can customize this theme, build it and have the effect in jupyter lab

  • install miniconda from here https://docs.conda.io/en/latest/miniconda.html (chose python3.7 one)
  • open Anaconda Terminal, [in windows goto search type Anaconda, select the terminal]
  • then run this conda create -n jupyterlab-ext -c conda-forge --override-channels nodejs jupyterlab cookiecutter git
  • clone jupyterlab from here https://github.com/jupyterlab/jupyterlab.git
  • switch branch with git checkout 0.35.x
  • then jlpm install
    jlpm build
    npm run create:theme
  • copy the theme folder to your chosen local theme folder for extension development. Replace tsconfig.json content with the following

{ "compilerOptions":
{ "declaration": true,
"lib": ["es2015", "dom"],
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noUnusedLocals": true,
"outDir": "lib",
"rootDir": "src",
"strict": true,
"strictNullChecks": false,
"target": "es2015",
"types": []
},
"include": ["src/*"]
}

[created by the steps here https://jupyterlab.readthedocs.io/en/stable/developer/xkcd_extension_tutorial.html#xkcd-extension-tutorial]

inside the theme folder ..

  • run the following commands jlpm install, jlpm run build , jlpm run build:webpack
  • open another conda terminal, there go to repo folder and run conda activate jupyterlab-ext then jupyter labextension install .
  • in a conda terminal conda activate jupyterlab-ext then, jupyter lab --watch

For version 1.0 , this cookie cutter could be used ... https://github.com/jupyterlab/theme-cookiecutter

How do I launch jupyter lab with the dark theme enabled by default?

Put this in ~/.jupyterlab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings

{
"theme": "JupyerLab Dark"
}

In the Dockerfile this might look like:

RUN mkdir -p ~/.jupyterlab/user-settings/@jupyterlab/apputils-extension/ && \
echo '{ "theme":"JupyterLab Dark" }' > themes.jupyterlab-settings

How to change the color of bold texts by changing index.css in Jupyter Lab?

I made some changes recently on my themes, so, according to my experience:

  1. The file you must to modify is the one inside the "share" folder: share\jupyter\lab\themes\@jupyterlab\theme-light-extension\index.css

  2. The only bold texts I found on my code mirror are marked as "Keywords" (i.e. import, for, in, try, def, etc)

If you want to change these bold text, you must to modify inside your index.css file the --jp-mirror-editor-keyword-color variable.

How to bring the colab dark theme to Jupyter Notebook

First, you have to install Jupyter Themes:

pip install jupyterthemes

Then, i think Colab uses the theme "onedork", so just set it using:

jt -t onedork

For some more info about Jupyter Themes, you can check https://github.com/dunovank/jupyter-themes



Related Topics



Leave a reply



Submit