CSS 如何将主题应用于 jupyter 实验室
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40518614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to apply theme to jupyter lab
提问by queezz
I tried to apply dark theme by putting a *.css file in the ~/.jupyter/custom/ directory (like here). This changes a theme for a normal jupyter notebook. But no affect on the jupyter lab appearance. I also tried to install a theme using jupyter-theme, but alas, no changes in jupyter lab appearance.
我试图通过在 ~/.jupyter/custom/ 目录中放置一个 *.css 文件来应用深色主题(如这里)。这会更改普通 jupyter 笔记本的主题。但对 jupyter 实验室外观没有影响。我还尝试使用 jupyter-theme 安装一个主题,但遗憾的是,jupyter 实验室外观没有变化。
Can someone point me to the how-to guide?
有人可以指出我的操作指南吗?
回答by queezz
UPDATE02/03/2018 Now this option is already built in in the settings menu!
更新02/03/2018 现在这个选项已经内置在设置菜单中了!
Recently this issue was closed on the GitHub, and finally it is possible to edit settings of the jupyter lab. Hurray!
最近在GitHub上关闭了这个issue,终于可以编辑jupyter实验室的设置了。欢呼!
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.
只需更新您的 jupyter-lab(现在是 0.27.0 版)并转到“文件”-“设置”,然后选择“主题”选项卡。并在用户覆盖中键入您的主题名称,然后按字符串右侧的复选标记。我尝试了几个,但只有“主题”:“JupyterLab Dark”似乎有效。对我来说足够了。
I really appreciate the work the jupyter team is doing. Thank you all!
我非常感谢 jupyter 团队所做的工作。谢谢你们!
回答by Neal Fultz
I bit the bullet, and figured out how to write a full custom theme as an extension.
我咬紧牙关,想出了如何编写一个完整的自定义主题作为扩展。
The process is:
过程是:
- Copy the Light theme from
jupyterlab/packages
to your own repository. - Edit the package metadata in
package.json
andsrc/index.ts
- Edit the CSS stylesheets in
styles
- Install the theme using
jupyter labextensions install .
- You may need to manually generate dependencies using
node
- You may need to manually generate dependencies using
- 将 Light 主题从
jupyterlab/packages
您自己的存储库中复制。 - 在
package.json
和 中编辑包元数据src/index.ts
- 编辑 CSS 样式表
styles
- 使用安装主题
jupyter labextensions install .
- 您可能需要使用手动生成依赖项
node
- 您可能需要使用手动生成依赖项
Here is my theme for future reference - https://github.com/nfultz/jupyterlab-theme-simple-extension
这是我的主题以供将来参考 - https://github.com/nfultz/jupyterlab-theme-simple-extension
EDIT:
编辑:
There's now a cookiecutter template to make it easier: https://github.com/jupyterlab/theme-cookiecutter
现在有一个 cookiecutter 模板可以让它更容易:https: //github.com/jupyterlab/theme-cookiecutter