如何编辑 jupyter lab 主题

How to edit jupyter lab theme

, it is now possible to edit the Jupyter Lab theme. However, this theme has a few issues for me personally. For example, it makes plot axes hard to read, since their default color is black. Other users have had similar problems。因此,我想分叉现有的主题并将绘图显示单元格设为浅灰色。如何做到这一点?

我试图找到相应的 .css 文件,但我只能找到 /usr/local/share/jupyter/lab/themes/@jupyterlab/theme-dark-extension/。我知道我可以编辑 index.css 来实现我想要的,但是我该如何分叉该主题并进行编辑呢?如何让 Jupyter Lab 知道我的自定义主题?

  • 首先 fork Jupyter Lab 项目,然后编辑并提交你的 变化。

  • 其次,去Jupyter Lab项目问pull request

  • 如果他们喜欢您的项目,他们会接受您的更改并将其放在 他们的主分支

为了扩展@Payam Khaninejad 的答案,一旦您分叉了 Jupyter Lab 项目,您需要找到 variables.css 文件并进行所需的编辑。

然后您可以在 Github https://github.com/jupyterlab/jupyterlab/issues/3855 and get help to format your pull request to conform to the style used by the Jupyter Lab project. Info on contributing to the project here.

上加入当前(发布时)问题

这是我写的回复,详细说明了更改 Jupyter Lab 界面的步骤:

要编辑 Jupypter Lab 主题,您需要更改位于 jupyterlab/packages/[THEME NAME]/style/

中的文件 variables.css

您可以检查要更改的 Jupyter Lab 元素以找出其 class。我使用 Chrome DevTools ctrl+shift+i 并单击各种 div classes 直到找到我想要更改的那个。

获得要自定义的 div class 的名称后,将更改添加到 variables.css 文件。这是我更改的内容和结果。

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

您可以使用由 JupyterLab 贡献者之一创建的 this gist (where the code in the first cell comes from) 来试验您对 variables.css 文件所做的更改。

我们正在使用版本 0。35.x ... 以下步骤对我有用……它将创建浅色主题的克隆,将其安装在 jupyter 实验室中,您将能够从设置菜单中 select。你可以自定义这个主题,构建它并在jupyter lab中产生效果

  • 从这里安装 miniconda https://docs.conda.io/en/latest/miniconda.html(选择 python3.7 一个)
  • 打开 Anaconda 终端,[在 windows 中转到搜索类型​​ Anaconda,select 终端]
  • 然后运行这个conda create -n jupyterlab-ext -c conda-forge --override-channels nodejs jupyterlab cookiecutter git
  • 从这里克隆 jupyterlab https://github.com/jupyterlab/jupyterlab.git
  • 切换分支 git checkout 0.35.x
  • 然后 jlpm install jlpm build npm run create:theme
  • 将主题文件夹复制到您选择的本地主题文件夹以进行扩展开发。将tsconfig.json内容替换为以下内容

{ "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/*"] } [由这里的步骤创建https://jupyterlab.readthedocs.io/en/stable/developer/xkcd_extension_tutorial.html#xkcd-extension-tutorial]

主题文件夹内..

  • 运行 以下命令 jlpm install, jlpm run build , jlpm run build:webpack
  • 打开另一个 conda 终端,然后转到 repo 文件夹和 运行 conda activate jupyterlab-ext then jupyter labextension install .
  • 在 conda 终端中 conda activate jupyterlab-ext 然后,jupyter lab --watch

对于 1.0 版,可以使用这个 cookie cutter ... https://github.com/jupyterlab/theme-cookiecutter