更改Jupyter notebook主题
jupyter notebook是一款写代码的神奇,那么如何在使用的过程中,修改主题呢?学习了github文档,总结如下:
一:安装或更新jupyterthemes
# install jupyterthemes pip install jupyterthemes # upgrade to latest version pip install --upgrade jupyterthemes
二:输入相关命令
jt [-h] [-l] [-t THEME] [-f MONOFONT] [-fs MONOSIZE] [-nf NBFONT] [-nfs NBFONTSIZE] [-tf TCFONT] [-tfs TCFONTSIZE] [-dfs DFFONTSIZE] [-m MARGINS] [-cursw CURSORWIDTH] [-cursc CURSORCOLOR] [-vim] [-cellw CELLWIDTH] [-lineh LINEHEIGHT] [-altp] [-altmd] [-altout] [-P] [-T] [-N] [-r] [-dfonts]
常用的命令参数解释如下:
参数含义 | 参数名称 | 默认值 |
---|---|---|
主题列表 | -l | -- |
主题名称 | -t | -- |
字体 | -f | -- |
字体大小 | -fs | 11 |
jupyter字体 | -nf | -- |
jupyter字体大小 | nfs | 13 |
Text/MD Cell Font | -tf | -- |
Text/MD Cell Fontsize | -tfs | 13 |
Pandas DF Fontsize | -dfs | 9 |
Cell Width | -cellw | 980 |
Line Height | -lineh | 170 |
... | ... | ... |
更多参数含义参考jupyter notebook github文档
三、主题设置示例
# list available themes # onedork | grade3 | oceans16 | chesterish | monokai | solarizedl | solarizedd jt -l # select theme... jt -t chesterish # restore default theme # NOTE: Need to delete browser cache after running jt -r # If this doesn't work, try starting a new notebook session. jt -r # toggle toolbar ON and notebook name ON jt -t grade3 -T -N # toggle kernel logo. kernel logo is in same container as name # toggled with -N. That means that making the kernel logo visible is # pointless without also making the name visible jt -t grade3 -N -kl # set code font to 'Roboto Mono' 12pt # (see monospace font table below) jt -t onedork -f roboto -fs 12 # set code font to Fira Mono, 11.5pt # 3digit font-sizes get converted into float (115-->11.5) # 2digit font-sizes > 25 get converted into float (85-->8.5) jt -t solarizedd -f fira -fs 115 # set font/font-size of markdown (text cells) and notebook (interface) # see sans-serif & serif font tables below jt -t oceans16 -tf merriserif -tfs 10 -nf ptsans -nfs 13 # adjust cell width (% screen width) and line height jt -t chesterish -cellw 90% -lineh 170 # or set the cell width in pixels by leaving off the '%' sign jt -t solarizedl -cellw 860 # fix the container-margins on the intro page (defaults to 'auto') jt -t monokai -m 200 # adjust cursor width (in px) and make cursor red # options: b (blue), o (orange), r (red), p (purple), g (green), x (font color) jt -t oceans16 -cursc r -cursw 5 # choose alternate prompt layout (narrower/no numbers) jt -t grade3 -altp # my two go-to styles # dark jt -t onedork -fs 95 -altp -tfs 11 -nfs 115 -cellw 88% -T # light jt -t grade3 -fs 95 -altp -tfs 11 -nfs 115 -cellw 88% -T
四、推荐的主题设置
jt -t chesterish -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T jt -t grade3 -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T jt -t gruvboxd -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T jt -t gruvboxl -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T jt -t monokai -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T jt -t oceans16 -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T jt -t onedork -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T jt -t solarizedd -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T jt -t solarizedl -f fira -fs 17 -cellw 90% -ofs 15 -dfs 15 -T -T
参看文章
https://www.cnblogs.com/shanger/p/12006161.html
设置jupyter notebook扩展
参考:https://blog.csdn.net/weixin_40509040/article/details/104827231
参考:https://blog.csdn.net/m0_56192771/article/details/124448207
谢谢观看!
手动安装
要手动安装Jupyter Notebook的Hinterland扩展,你可以按照以下步骤进行操作:
打开终端(命令提示符或终端窗口)。
确保你已经安装了Jupyter Notebook。如果没有安装,可以使用以下命令安装:
pip install jupyter
使用以下命令安装Jupyter Notebook的Hinterland扩展:
pip install jupyter_contrib_nbextensions
使用以下命令激活扩展:
jupyter contrib nbextension install --user
使用以下命令启用Hinterland扩展:
jupyter nbextension enable hinterland/hinterland
重新启动Jupyter Notebook,可以使用以下命令:
jupyter notebook
扩展列表:https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人