9

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?

quant
  • 21,507
  • 32
  • 115
  • 211

2 Answers2

6

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
mike
  • 4,901
  • 2
  • 19
  • 19
  • In saturncloud.io you need to change URL a little bit from @mike. mkdir -p ~/.jupyter/lab/jupyterlab/user-settings/@jupyterlab/apputils-extension/ && echo '{ "theme":"JupyterLab Dark" }' > themes.jupyterlab-settings – MarkusOdenthal Apr 30 '21 at 12:44
  • A couple of issues... the path seems to be `~/jupyter/lab/user-settings...` now with the extra slash. And whilst the `mkdir` makes the directory, the `echo` actually writes in the current directory if you don't `cd` there first. – Mark Setchell Jul 27 '23 at 10:57
5

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/
GenError
  • 885
  • 9
  • 25