我喜欢黑暗题材。但是,Jupyter笔记本的默认主题是浅色,我找不到更改主题/背景色的选项。这是怎么做到的?
当前回答
而不是在Jupyter内部安装一个库,我建议你使用Chrome中的“黑暗阅读器”扩展(你可以在其他浏览器中找到“黑暗阅读器”扩展,例如Firefox)。 你可以玩它;过滤URL(s)你想有黑暗主题,甚至如何定义黑暗主题为自己。 下面是几个例子:
我希望这能有所帮助。
其他回答
如前所述,您可以安装使用更广泛的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。
使用FireFox插件“暗黑木星”。
使用conda直接安装Jupyterthemes包,使用:
conda install -c conda-forge jupyterthemes
然后,正如其他人指出的那样,使用jt -t <theme-name>更改主题
暗模式:-
我已经使用Raleway字体样式
到C:\User\UserName\.jupyter\custom\custom.css文件
附加给定的样式,这是专门为黑暗模式的jupyter笔记本…
这应该是您当前的custom.css文件:-
/* This file contains any manual css for this page that needs to override the global styles.
This is only required when different pages style the same element differently. This is just
a hack to deal with our current css styles and no new styling should be added in this file.*/
#ipython-main-app {
position: relative;
}
#jupyter-main-app {
position: relative;
}
现在开始追加内容
.header-bar {
display: none;
}
#header-container img {
display: none;
}
#notebook_name {
margin-left: 0px !important;
}
#header-container {
padding-left: 0px !important
}
html,
body {
overflow: hidden;
font-family: OpenSans;
}
#header {
background-color: #212121 !important;
color: #fff;
padding-top: 20px;
padding-bottom: 50px;
}
.navbar-collapse {
background-color: #212121 !important;
color: #fff;
border: none !important
}
#menus {
border: none !important;
color: white !important;
}
#menus .dropdown-toggle {
color: white !important;
}
#filelink {
color: white !important;
text-align: centerimportant;
padding-left: 7px;
text-decoration: none !important;
}
.navbar-default .navbar-nav>.open>a,
.navbar-default .navbar-nav>.open>a:hover,
.navbar-default .navbar-nav>.open>a:focus {
background-color: #191919 !important;
color: #eee !important;
text-align: left !important;
}
.dropdown-menu,
.dropdown-menu a,
.dropdown-submenu a {
background-color: #191919;
color: #fff !important;
}
.dropdown-menu>li>a:hover,
.dropdown-menu>li>a:focus,
.dropdown-submenu>a:after {
background-color: #212121;
color: #fff !important;
}
.btn-default {
color: #fff !important;
background-color: #212121 !important;
border: none !important;
}
.dropdown {
text-align: left !important;
}
.form-control.select-xs {
background-color: #191919 !important;
color: #eee !important;
border: none;
outline: none;
}
#modal_indicator {
display: none;
}
#kernel_indicator {
color: #fff;
}
#notification_trusted,
#notification_notebook {
background-color: #212121;
color: #eee !important;
border: none;
border-bottom: 1px solid #eee;
}
#logout {
background-color: #191919;
color: #eee;
}
#maintoolbar-container {
padding-top: 0px !important;
}
.notebook_app {
background-color: #222222;
}
::-webkit-scrollbar {
display: none;
}
#notebook-container {
background-color: #212121;
}
div.cell.selected,
div.cell.selected.jupyter-soft-selected {
border: none !important;
}
.cm-keyword {
color: orange !important;
}
.input_area {
background-color: #212121 !important;
color: white !important;
border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
.cm-def {
color: #5bc0de !important;
}
.cm-variable {
color: yellow !important;
}
.output_subarea.output_text.output_result pre,
.output_subarea.output_text.output_stream.output_stdout pre {
color: white !important;
}
.CodeMirror-line {
color: white !important;
}
.cm-operator {
color: white !important;
}
.cm-number {
color: lightblue !important;
}
.inner_cell {
border: 1px thin #eee;
border-radius: 50px !important;
}
.CodeMirror-lines {
border-radius: 20px;
}
.prompt.input_prompt {
color: #5cb85c !important;
}
.prompt.output_prompt {
color: lightblue;
}
.cm-string {
color: #6872ac !important;
}
.cm-builtin {
color: #f0ad4e !important;
}
.run_this_cell {
color: lightblue !important;
}
.input_area {
border-radius: 20px;
}
.output_png {
background-color: white;
}
.CodeMirror-cursor {
border-left: 1.4px solid white;
}
.box-flex1.output_subarea.raw_input_container {
color: white;
}
input.raw_input {
color: black !important;
}
div.output_area pre {
color: white
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: white !important;
font-weight: bolder !important;
}
.CodeMirror-gutter.CodeMirror-linenumber,
.CodeMirror-gutters {
background-color: #212121 !important;
}
span.filename:hover {
color: #191919 !important;
height: auto !important;
}
#site {
background-color: #191919 !important;
color: white !important;
}
#tabs li.active a {
background-color: #212121 !important;
color: white !important;
}
#tabs li {
background-color: #191919 !important;
color: white !important;
border-top: 1px thin #eee;
}
#notebook_list_header {
background-color: #212121 !important;
color: white !important;
}
#running .panel-group .panel {
background-color: #212121 !important;
color: white !important;
}
#accordion.panel-heading {
background-color: #212121 !important;
}
#running .panel-group .panel .panel-heading {
background-color: #212121;
color: white
}
.item_name {
color: white !important;
cursor: pointer !important;
}
.list_item:hover {
background-color: #212121 !important;
}
.item_icon.icon-fixed-width {
color: white !important;
}
#texteditor-backdrop {
background-color: #191919 !important;
border-top: 1px solid #eee;
}
.CodeMirror {
background-color: #212121 !important;
}
#texteditor-backdrop #texteditor-container .CodeMirror-gutter,
#texteditor-backdrop #texteditor-container .CodeMirror-gutters {
background-color: #212121 !important;
}
.celltoolbar {
background-color: #212121 !important;
border: none !important;
}
推荐文章
- 如何知道哪个Python在Jupyter笔记本上运行?
- 使用Python 3在Jupyter Notebook中使用相对导入从位于另一个目录中的模块导入本地函数
- 如何在编辑器(Atom, notepad++, Kate, VIM, Sublime, Textpad等)和ide (NetBeans, IntelliJ IDEA, Eclipse, Visual Studio等)中选择列
- 使用Emacs递归地查找和替换尚未打开的文本文件
- 如何嵌入HTML到IPython输出?
- 如何使Sublime Text成为Git的默认编辑器?
- 禁止在vim中创建交换文件
- 如何从终端运行。ipynb Jupyter Notebook ?
- 移除jupyter笔记本上的内核
- 基于gui或基于web的JSON编辑器,工作方式类似于属性浏览器
- 如何加载/编辑/运行/保存文本文件(.py)到IPython笔记本细胞?
- 如何改变AlertDialog的主题
- notepad++是否显示所有隐藏字符?
- 在安装pip后,“jupyter:命令未找到”
- 在IPython中自动重载模块