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

时间:2015-01-14 23:07:50

标签: python macos python-2.7 ipython ipython-notebook

我想为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

3 个答案:

答案 0 :(得分:5)

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

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

ipython profile create ocean

使用以下命令将默认样式表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

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

ipython notebook --profile=ocean

<强>替代:

如果您无法使用curl下载,只需下载base16-ocean-dark.css并替换您创建的个人资料的自定义目录中的custom.css即可。

找到个人资料目录:

ipython locate profile ocean

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

答案 1 :(得分:4)

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

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

  

安装jupyter-themes

$ pip install --upgrade jupyterthemes
     

选择主题并安装

# 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

答案 2 :(得分:1)

我已经以jupyterthemes的名义为pypi添加了jupyter-themes。

安装最新版本:

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

希望能够解决人们遇到的主题没有出现的任何问题(@llya)。

相关问题