温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

利用jupyter notebook怎么实现一个更换皮肤主题功能

发布时间:2021-01-08 16:16:38 来源:亿速云 阅读:319 作者:Leah 栏目:开发技术

今天就跟大家聊聊有关利用jupyter notebook怎么实现一个更换皮肤主题功能,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

下载jupyterthemes

我们可以通过pip来安装jupyterthemes

pip install jupyterthemes

也可以通过下列命令来更新jupyterthemes到最新版本

pip install --upgrade jupyterthemes

使用jupyterthemes

那么下载完成后,我们可以在终端使用 jupyter-theme 命令来更改notebook主题

jupyter-theme -h # 查看jupyter-theme的帮助手册

您也可以通过 jupyter-theme 的命令简写 jt 来使用

jt -h # 查看jupyter-theme的帮助手册

强烈推荐第二种方式,因为懒惰是程序员的基本美德

jupyter-theme参数详解

功能介绍选项参数默认值
查看帮助文档-h--
展示所有的皮肤主题-l--
设置安装的主题-t--
设置代码字体样式-f--
设置代码字体大小-fs11
设置notebook的字体样式-nf--
设置notebook的字体大小-nfs13
设置text/md的cell字体样式-tf--
设置text/md的cell字体大小-tfs13
设置Pandas的DataFrame字体大小-dfs9
设置输出区域的字体大小-ofs8.5
设置Mathjax的字体大小(%)-mathfs100
设置页面的margin外边距-mauto
设置Cell的宽度-cellw980
设置行高-lineh170
设置光标的宽度-cursw2
设置光标的颜色-cursc--
Alt Prompt Layout-altp--
Alt Markdown BG Color-altmd--
Alt Output BG Color-altout--
Style Vim NBExt*-vim--
Toolbar是否可见-T--
文件名和Logo是否可见-N--
内核的Logo是否可见-kl--
重置为默认的notebook主题-r--
重置为默认的字体-dfonts--

code cells的可选字体样式

-f argMonospace Font
ankaAnka/Coder
anonymousAnonymous Pro
aurulentAurulent Sans Mono
bitstreamBitstream Vera Sans Mono
bpmonoBPmono
codeCode New Roman
consolamonoConsolamono
cousineCousine
dejavuDejaVu Sans Mono
droidmonoDroid Sans Mono
firaFira Mono
firacodeFira Code
genericGeneric Mono
hackHack
haskligHasklig
inconsolataInconsolata-g
inputmonoInput Mono
iosevkaIosevka
liberationLiberation Mono
mesloMeslo
officeOffice Code Pro
oxygenOxygen Mono
robotoRoboto Mono
saxmonosaxMono
sourceSource Code Pro
sourcemedSource Code Pro Medium
ptmonoPT Mono
ubuntuUbuntu Mono

notebook与text/md cells的可选字体样式

Sans-Serif Fonts

-nf/-tf argSans-Serif Font
opensansOpen Sans
droidsansDroid Sans
exosansExo_2
latosansLato
ptsansPT Sans
robotosansRoboto
sourcesansSource Sans Pro

Serif Fonts

-nf/-tf argSerif Font
loraserifLora
ptserifPT Serif
georgiaserifGeorgia
cardoserifCardo
crimsonserifCrimson Text
ebserifEB Garamond
merriserifMerriweather
neutonserifNeuton
goudyserifSorts Mill Goudy

jupyter-theme使用示例

# 查看所有可选主题
# chesterish | grade3 | gruvboxd | gruvboxl | monokai | oceans16 | onedork | solarizedd | solarizedl
jt -l

# 切换使用grade3主题
# 一般刷新notebook页面就可以看到效果,如果没起作用的话,可能需要删除一下浏览器的缓存
jt -t grade3

# 重置notebook的主题,回到解放前
jt -r

# 默认展示工具箱以及文件名
jt -t monokai -T -N

# 设置notebook界面和text/md cells的字体样式,并且设置字体大小
# 字体大小的单位为pt
jt -t oceans16 -tf merriserif -tfs 10 -nf ptsans -nfs 13

# 设置cell的宽度与行高
# 可以通过百分比来设置宽度
jt -t chesterish -cellw 90% -lineh 170

# 通过像素px来设置cell的宽度,设置为860px
jt -t solarizedd -cellw 860

# 设置光标变成红色,并且将其大小变为5px
# 可选的颜色 b (blue), o (orange), r (red), p (purple), g (green), x (font color)
jt -t solarizedl -cursc r -cursw 5

jupyter-theme可用主题一览

默认主题

利用jupyter notebook怎么实现一个更换皮肤主题功能

chesterish

利用jupyter notebook怎么实现一个更换皮肤主题功能

grade3

利用jupyter notebook怎么实现一个更换皮肤主题功能

gruvboxd

利用jupyter notebook怎么实现一个更换皮肤主题功能

gruvboxl

利用jupyter notebook怎么实现一个更换皮肤主题功能

monokai

利用jupyter notebook怎么实现一个更换皮肤主题功能

oceans16

利用jupyter notebook怎么实现一个更换皮肤主题功能

onedork

利用jupyter notebook怎么实现一个更换皮肤主题功能

solarizedd

利用jupyter notebook怎么实现一个更换皮肤主题功能

solarizedl

利用jupyter notebook怎么实现一个更换皮肤主题功能

看完上述内容,你们对利用jupyter notebook怎么实现一个更换皮肤主题功能有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注亿速云行业资讯频道,感谢大家的支持。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI