我喜欢黑暗题材。但是,Jupyter笔记本的默认主题是浅色,我找不到更改主题/背景色的选项。这是怎么做到的?
当前回答
简单,Jupyter字体大小和内外背景颜色的全局更改(此更改将影响所有笔记本电脑)。
在Windows下,通过运行命令找到config目录: jupyter——config-dir
在Linux中是~/.jupyter
在此目录中创建子文件夹custom 创建文件custom.css并粘贴:
/* Change outer background and make the notebook take all available width */
.container {
width: 99% !important;
background: #DDC !important;
}
/* Change inner background (CODE) */
div.input_area {
background: #F4F4E2 !important;
font-size: 16px !important;
}
/* Change global font size (CODE) */
.CodeMirror {
font-size: 16px !important;
}
/* Prevent the edit cell highlight box from getting clipped;
* important so that it also works when cell is in edit mode */
div.cell.selected {
border-left-width: 1px !important;
}
最后,重启Jupyter。结果:
其他回答
简单,Jupyter字体大小和内外背景颜色的全局更改(此更改将影响所有笔记本电脑)。
在Windows下,通过运行命令找到config目录: jupyter——config-dir
在Linux中是~/.jupyter
在此目录中创建子文件夹custom 创建文件custom.css并粘贴:
/* Change outer background and make the notebook take all available width */
.container {
width: 99% !important;
background: #DDC !important;
}
/* Change inner background (CODE) */
div.input_area {
background: #F4F4E2 !important;
font-size: 16px !important;
}
/* Change global font size (CODE) */
.CodeMirror {
font-size: 16px !important;
}
/* Prevent the edit cell highlight box from getting clipped;
* important so that it also works when cell is in edit mode */
div.cell.selected {
border-left-width: 1px !important;
}
最后,重启Jupyter。结果:
如前所述,您可以安装使用更广泛的jupyterthemes。 但是,我也可以更喜欢和推荐jupyter-themer,它更容易使用,不影响jupyter笔记本的默认形状。
安装:pip install jupyter-themer
带有文档和示例的存储库(*目前,示例存储在未合并的pull-request中):@github: jupyter-thamer
我最喜欢的定制:jupyter-themer -b dark -c zenburn。
遵循以下步骤
使用pip安装jupyterthemes:
pip install jupyterthemes
然后从下面选择主题,并使用以下命令设置它们。一旦成功安装,我们中的许多人认为我们需要再次启动jupyter服务器,只需刷新页面。
使用以下命令设置主题:
jt -t <theme-name>
可用的主题:
onedork grade3 oceans16 chesterish monokai solarizedl solarizedd
可用主题的截图在其Github存储库中。
在设置主题时,还可以在同一个命令中指定-T(——toolbar)来保留工具栏,否则工具栏将不显示。如需帮助,请输入jt -h。
另一个选择是如果你使用谷歌chrome,想要一个黑暗的主题,让你在jupyter/网页上工作几个小时更容易,同时也让你的代码中的配色方案可读,那就是在实验中使用“Web内容的自动暗模式”标志- chrome://flags -我通常会选择“启用选择性图像反转”选项。
我的完整解决方案:
1)在chrome上获得黑暗读者,这不仅会让你为Jupyter一个伟大的黑暗主题,而且为每一个你想要的网站(你可以玩不同的过滤器。我使用Dynamic)。
2)将这些代码行粘贴到你的笔记本上,这样图例和轴就可以看到了:
from jupyterthemes import jtplot
jtplot.style(theme='monokai', context='notebook', ticks=True, grid=False)
你已经为迪斯科编码之夜做好了准备!
推荐文章
- 如何在notepad++文本编辑器中更改背景颜色?
- 如何在Jupyter Notebook中显示文件中的图像?
- 修改IPython/Jupyter笔记本工作目录
- 在ipython笔记本中测量单元格执行时间的简单方法
- 如何在Sublime Text 2中用制表符替换四个空格?
- 插入图像到IPython笔记本markdown
- Jupyter在哪个conda环境中执行?
- Sublime文本和Github的Atom之间有什么区别
- 在iPython Notebook中显示DataFrame为表
- Jupyter Notebook未保存:post中缺少“_xsrf”参数
- 如何在vim中交换两个打开文件的位置(在分割中)?
- 如何在IPython Notebook上编写LaTeX ?
- 我如何阻止评论在Jupyter笔记本?
- 如何添加python3内核到jupyter (IPython)
- Jupyter Notebook和JupyterLab有什么区别?