quant
quant

Reputation: 23082

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

The answer to this question points out that the "JupyterLab Dark" theme is now available as part of a vanilla jupyter-lab install.

How can I configure jupyter-lab so that it launches with this theme already applied on the first launch, so I don't have to manually select it every time I launch my jupyter docker container?

Upvotes: 9

Views: 4780

Answers (3)

Nir
Nir

Reputation: 1894

Based on @mike's answer + @Mark Setchell's comment,

ARG USER=docker_user
RUN mkdir -p /home/$USER/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/ && \  
    echo '{ "theme":"JupyterLab Dark" }' > /home/$USER/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings

For me the '~' to replace /home/$USER did not work as well

Important note: The .jupyterlab folder seemed to have changed to .jupyter/lab, as commented in the original answer

Upvotes: 0

GenError
GenError

Reputation: 1186

As the answer from mike and the comment from MarkusOdenthal did not work for me when I used the jupyter docker stacks I looked for a different solution and it seams using overrides.json is the current recommended approach:

https://jupyterlab.readthedocs.io/en/stable/user/directories.html#overridesjson

In short: check the application directory with jupyter lab path and place a file named overrides.json containing

{
    "@jupyterlab/apputils-extension:themes": {
        "theme": "JupyterLab Dark"
    }
}

into <application directory>/settings/ (e.g. /opt/conda/share/jupyter/lab/settings/ for the official jupyter docker containers)

So if you want to have the base image from jupyter with dark theme, the Dockerfile would be

FROM jupyter/base-notebook

COPY overrides.json /opt/conda/share/jupyter/lab/settings/

Upvotes: 8

mike
mike

Reputation: 5581

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

Upvotes: 7

Related Questions