How to edit a JupyterLab theme?

老子叫甜甜 提交于 2019-12-11 02:34:42

问题


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

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".

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!

Related issue on GitHub:

  • link

Related SO questions:

  • link
  • link

回答1:


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

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.

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
}

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.



来源:https://stackoverflow.com/questions/51191993/how-to-edit-a-jupyterlab-theme

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!