在Ipython中设置新主题的问题?

new*_*hon 1 python macos ipython python-2.7 ipython-notebook

我想为Ipython笔记本使用另一个主题,所以我按照这个说明问题是我在OSX中,我没有wget,我安装了自制软件.有人可以帮我设置一个黑暗主题的ipython笔记本吗?我试过这个:

brew /Users/user/.ipython/profile_notebooks/static/custom/custom.css
https://raw.githubusercontent.com/nsonnad/base16-ipython-notebook/master/base16-ocean-dark.css
Run Code Online (Sandbox Code Playgroud)

Ami*_*mit 5

您可以使用curl或手动下载主题.我已经为以下两个选项提供了步骤.

使用以下命令创建自定义配置文件:

ipython profile create ocean
Run Code Online (Sandbox Code Playgroud)

custom.css使用以下命令将默认样式表的内容替换为所需主题的内容

使用curl:

curl -o `ipython locate profile ocean`/static/custom/custom.css https://raw.githubusercontent.com/nsonnad/base16-ipython-notebook/master/base16-ocean-dark.css
Run Code Online (Sandbox Code Playgroud)

IPython通过指定自定义配置文件启动笔记本,例如

ipython notebook --profile=ocean
Run Code Online (Sandbox Code Playgroud)

替代方案:

如果您无法下载使用curl,只需下载base16-ocean-dark.css并替换custom.css您创建的配置文件的自定义目录即可.

找到配置文件目录:

ipython locate profile ocean
Run Code Online (Sandbox Code Playgroud)

转到其static/custom目录并将内容替换custom.css为下载css文件的内容.IPython如上所示,通过指定自定义配置文件启动笔记本.


Mit*_*ril 5

Amit 的答案不适合ipython=>4.0,因为jupyter现在与它分开了。

你可以试试jupyter-themes。它适合ipython=>4.0并且更容易安装。

安装 jupyter-themes

$ pip install --upgrade jupyterthemes
Run Code Online (Sandbox Code Playgroud)

选择一个主题并安装

# list themes (located in ~/.jupyter-themes)
$ jt -l

# install theme (-t) for jupyter nb
# theme names: oceans16 | grade3 | space-legos
$ jt -t grade3

# install a theme (-t) with toolbar (-T) enabled
$ jt -T -t grade3

# install a theme (-t) and set font-size (-f), default value is 11
$ jt -f 12 -t grade3

# reset (-r) to default for jupyter theme
$ jt -r
Run Code Online (Sandbox Code Playgroud)