如何编辑JupyterLab主题? [英] How to edit a JupyterLab theme?

查看:195
本文介绍了如何编辑JupyterLab主题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编辑JupyterLab Dark Theme,以便可以清楚地读取内嵌图上的轴标签.问题示例:

I'd like to edit the JupyterLab Dark Theme, so that axis labels on inline plots can be clearly read. Example of the problem:

为解决此问题,我想将包含图像的输出单元格的背景色更改为灰色阴影.我使用Chrome DevTools来检查网页,并找到了类class="p-Widget jp-RenderedImage jp-mod-trusted jp-OutputArea-output".

To remedy this problem I'd like to change the background colour of output cells which contain an image to a shade of grey. I used Chrome DevTools to insepect the webpage and found the class class="p-Widget jp-RenderedImage jp-mod-trusted jp-OutputArea-output".

我注意到我可以通过使用JupyterLab Light主题或通过matplotlib中的暗色绘制主题来解决此问题,但是我想直接解决此问题.我欢迎所有阅读资源的建议或指示,这将有助于我理解和解决此问题.谢谢!

I've noted that I can workaround this problem by using the JupyterLab Light Theme or by using a dark plotting theme in matplotlib, however I'd like to address this issue directly. I welcome all suggestions or directions to resources to read which would help me to understand and fix this. Thanks!

GitHub上的相关问题:

Related issue on GitHub:

相关的SO问题:

  • link
  • link

推荐答案

要编辑Jupypter Lab主题,您需要更改文件

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

您可以检查要更改的Jupyter Lab元素,以查找其类.我使用了Chrome DevTools ctrl+shift+i,然后单击各种div类,直到找到想要更改的类.

You can inspect the element of the Jupyter Lab 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.

一旦有了要自定义的div类的名称,就将更改添加到variables.css文件中.这就是我所做的更改和结果.

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
}

您可以使用创建的此要点(第一个单元格中的代码来自哪里)由JupyterLab贡献者之一来试验您对variables.css文件所做的更改.

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.

这篇关于如何编辑JupyterLab主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆