在 Ipython 中设置新主题时遇到问题?

Problems setting up a new theme in Ipython?

我想为 Ipython 笔记本使用另一个主题,所以我按照这个 instructions 问题是我在 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

您可以使用 curl 或手动下载主题。我已经给出了以下两个选项的步骤。

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

ipython profile create ocean

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

使用卷曲:

curl -o `ipython locate profile ocean`/static/custom/custom.css https://raw.githubusercontent.com/nsonnad/base16-ipython-notebook/master/base16-ocean-dark.css

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

ipython notebook --profile=ocean

选择:

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

找到配置文件目录:

ipython locate profile ocean

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

Amit 的答案不适合 ipython=>4.0,因为 jupyter 现在已从中分离出来。

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

Install jupyter-themes

$ pip install --upgrade jupyterthemes

Pick a theme and install

# 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

我已将 jupyter-themes 添加到 pypi,名称为 jupyterthemes。

要安装最新版本:

#uninstall any old versions
pip uninstall jupyter-themes 
#install the latest version (no hyphen)
pip install jupyterthemes

希望这能解决人们遇到的主题未显示的任何问题 (@llya)。