我喜欢黑暗题材。但是,Jupyter笔记本的默认主题是浅色,我找不到更改主题/背景色的选项。这是怎么做到的?


当前回答

!pip install jupyterthemes

运行这个库:

from jupyterthemes import get_themes
import jupyterthemes as jt
from jupyterthemes.stylefx import set_nb_theme

这:

set_nb_theme('monokai')

主题:

’monokai’, ’chesterish’, ’oceans16’, ’solarizedl’, ’solarizedd’, ’grade3’, ’onedork’

其他回答

另一个选择是如果你使用谷歌chrome,想要一个黑暗的主题,让你在jupyter/网页上工作几个小时更容易,同时也让你的代码中的配色方案可读,那就是在实验中使用“Web内容的自动暗模式”标志- chrome://flags -我通常会选择“启用选择性图像反转”选项。

我的完整解决方案:

1)在chrome上获得黑暗读者,这不仅会让你为Jupyter一个伟大的黑暗主题,而且为每一个你想要的网站(你可以玩不同的过滤器。我使用Dynamic)。

2)将这些代码行粘贴到你的笔记本上,这样图例和轴就可以看到了:

from jupyterthemes import jtplot
jtplot.style(theme='monokai', context='notebook', ticks=True, grid=False)

你已经为迪斯科编码之夜做好了准备!

你可以直接在打开的笔记本上完成:

!pip install jupyterthemes
!jt -t chesterish

重新启动主题应用程序的jupyter服务器

如果有人有兴趣在启用主题的docker中运行anaconda

docker run -t --rm -p 8888:8888 -v $(pwd):/opt/notebooks continuumio/anaconda3 /bin/bash -c "pip install jupyterthemes; jt -t onedork; /opt/conda/bin/jupyter notebook --ip=0.0.0.0 --port=8888 --notebook-dir=/opt/notebooks --allow-root --no-browser;"

你可以按照这些步骤来做。

PIP install jupyterthemes或PIP install——upgrade jupyterthemes以升级到最新版本的主题。 然后列出所有的主题:jt -l 在jt-t <themename>之后,例如jt-t solarizedl