Mob*_*han 127 themes editor jupyter-notebook
我喜欢黑暗的主题.但是,Jupyter笔记本的默认主题很轻,我找不到更改主题/背景颜色的选项.这是怎么做到的?
Aar*_*ron 179
使用jupyter-themesKyle Dunovan 的包装很容易做到.您可以使用它来安装它conda.否则,您将需要使用pip.
用conda安装:
conda install jupyterthemes
Run Code Online (Sandbox Code Playgroud)
或者
pip install jupyterthemes
Run Code Online (Sandbox Code Playgroud)
然后改变你的主题
jt -t chesterish
Run Code Online (Sandbox Code Playgroud)
加载chesterish主题或任何其他.最后,重新加载页面.文档和源代码在这里:https://github.com/dunovank/jupyter-themes
Sah*_*pal 51
跟着这些步骤:-
点子安装主题.
pip install jupyterthemes
Run Code Online (Sandbox Code Playgroud)
然后从下面选择主题并使用以下命令进行设置:成功安装后,我们中的许多人认为我们需要再次启动jupyter服务器,只需刷新页面即可.设置主题.
jt -t <theme-name>
Run Code Online (Sandbox Code Playgroud)
主题名称列表
Ami*_*r F 24
您可以直接从打开的笔记本中执行此操作:
!pip install jupyterthemes
!jt -t chesterish
Run Code Online (Sandbox Code Playgroud)
Nat*_*bsi 24
我改变主题后表现得很奇怪.字体很小,看不到工具栏,我真的不喜欢新的样子.
对于那些想要恢复原始主题的人,可以按如下方式进行:
jt -r
Run Code Online (Sandbox Code Playgroud)
您需要在第一次执行时重新启动Jupyter,稍后刷新就足以启用新主题.
或直接从笔记本内部
!jt -r
Run Code Online (Sandbox Code Playgroud)
Woj*_*ski 20
!pip install jupyterthemes
Run Code Online (Sandbox Code Playgroud)
运行这个库:
!pip install jupyterthemes
Run Code Online (Sandbox Code Playgroud)
和这个:
set_nb_theme('monokai')
Run Code Online (Sandbox Code Playgroud)
主题:
'monokai'、'chesterish'、'oceans16'、'solarizedl'、'solarized'、'grade3'、'onedork'
raf*_*pek 13
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;
}
Run Code Online (Sandbox Code Playgroud)
最后 - 重新启动 Jupyter。结果:
Beh*_*hti 11
相反,安装内Jupyter库的,我会建议你使用'暗读者扩展- https://chrome.google.com/webstore/detail/dark-reader/eimadpbcbfnmbkopoojfekhnkhdbieeh在Chrome(你可以找到'黑暗读者扩展在其他浏览器(例如Firefox)中。你可以玩;过滤您要使用深色主题的网址,甚至过滤自己的深色主题。以下是几个示例:
希望对您有所帮助。贝鲁兹
您可以按照以下步骤操作。
pip install jupyterthemes或pip install --upgrade jupyterthemes升级到最新版本的主题。jt -ljt-t <themename>例如jt -t solarizedl我的完整解决方案:
在 chrome 上获取 Dark Reader,这不仅可以为 Jupyter 提供出色的深色主题,还可以为您想要的每个网站提供深色主题(您可以使用不同的过滤器。我使用 Dynamic)。
将这些代码行粘贴到笔记本中,以便图例和轴变得可见:
from jupyterthemes import jtplot
jtplot.style(theme='monokai', context='notebook', ticks=True, grid=False)
Run Code Online (Sandbox Code Playgroud)
您已准备好参加迪斯科编码之夜!
我已经使用 Raleway Font 来设计样式
到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;
}
Run Code Online (Sandbox Code Playgroud)
要追加的内容现在开始
.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;
}
Run Code Online (Sandbox Code Playgroud)
小智 6
要直接使用conda安装Jupyterthemes软件包,请使用:
conda install -c conda-forge jupyterthemes
Run Code Online (Sandbox Code Playgroud)
然后,正如其他人指出的那样,使用 jt -t <theme-name>
conda install jupyterthemes
Run Code Online (Sandbox Code Playgroud)
在 Windows 中对我不起作用。我正在使用蟒蛇。
但,
pip install jupyterthemes
Run Code Online (Sandbox Code Playgroud)
在 Anaconda Prompt 工作。
您可以使用运行笔记本中的 set_nb_theme 更改主题
!pip install jupyterthemes
from jupyterthemes import get_themes
import jupyterthemes as jt
from jupyterthemes.stylefx import set_nb_theme
set_nb_theme('chesterish')
Run Code Online (Sandbox Code Playgroud)
粘贴自https://www.kaggle.com/getting-started/97540
小智 5
如果您使用 google chrome 并想要一个深色主题,这样可以在 jupyter/网页中工作数小时,并且让代码中的配色方案保持可读性,那么另一种选择是使用“Web 内容的自动深色模式”实验中的标志 - chrome://flags - 我通常选择“启用选择性图像反转”选项。