简体   繁体   English

如何更改ipython笔记本的默认配色方案?

[英]How to change default colour scheme for ipython notebook?

Is there an easy way to change this? 有没有简单的方法来改变这个? I've just upgraded from ipython notebook v0.12 to 1.1 and it doesn't seem too bad so far but these colours are killing me. 我刚刚从ipython notebook v0.12升级到1.1,到目前为止看起来并不太糟糕,但这些颜色让我感到害怕。 I've been working for an hour now and because it's so bright my eyes are starting to hurt. 我已经工作了一个小时了,因为它太亮了我的眼睛开始受伤了。 Any advice would be great (other than turning down the brightness of my computer screen...) 任何建议都会很棒(除了调低我电脑屏幕的亮度......)

Notice 注意

The answer below pertains to the old IPython notebook. 以下答案适用于旧的IPython笔记本。 For the new Jupyter Notebook, please see this other answer . 对于新的Jupyter笔记本,请看其他答案

Historical answer 历史答案

As User mentioned in his answer , you need to modify the CSS of the notebook. 正如User他的回答中提到的,你需要修改笔记本的CSS。

Fortunately others have already done the hard work for you, so if you search for "IPython themes" you'll find pages like Nikhil Sonnad's , with pre-packaged CSS themes for IPython notebooks. 幸运的是,其他人已经为你完成了艰苦的工作,所以如果你搜索“IPython主题”,你会找到像Nikhil Sonnad这样的网页,为IPython笔记本提供预先打包的CSS主题。

Please read the page above in detail before using the themes, specially the detail that his themes do away with the toolbar (and how to get it back), but I'll paraphrase his instructions here, assuming that you want your IPython (version 3) notebook to use the ocean-dark theme, that you're running bash as your shell and that you have wget installed: 在使用主题之前请详细阅读上面的页面,特别是他的主题用工具栏取消的细节(以及如何取回它),但我会在这里解释他的说明,假设你想要你的IPython(版本3) )笔记本使用ocean-dark主题,你正在运行bash作为你的shell,你已经安装了wget

ipython profile create ocean-dark
wget -O `ipython locate profile ocean-dark`/static/custom/custom.css \
      https://github.com/nsonnad/base16-ipython-notebook/raw/master/ipython-3/output/base16-ocean-dark.css

Now, to run your IPython notebook with the ocean-dark theme, do 现在,要运行具有ocean-dark主题的IPython笔记本,请执行此操作

ipython notebook --profile=ocean-dark

Notice that there is no need to match the name of the theme with the name of the profile like in my example. 请注意,不需要像我的示例中那样将主题的名称与配置文件的名称相匹配。 You could do that in your own pre-existing profiles, or even in the default profile, by leaving out the profile name in the ipython locate command above. 您可以在自己的预先存在的配置文件中,甚至在默认配置文件中,通过在上面的ipython locate命令中ipython locate配置文件名称来实现。

I think you need to modify the CSS of the page. 我认为你需要修改页面的CSS。 Therefore you can return html. 因此你可以返回html。

Have a look at: http://catherinedevlin.blogspot.de/2013/06/easy-html-output-in-ipython-notebook.html 看看: http//catherinedevlin.blogspot.de/2013/06/easy-html-output-in-ipython-notebook.html

It could also be that there is a special HTML() object. 也可能是有一个特殊的HTML()对象。

i personally use "invert page color" to change white background to dark background. 我个人使用“反转页面颜色”将白色背景更改为深色背景。 (it is google chrome extension) (这是谷歌Chrome扩展)

invert page color is a google extension which helps to invert page color. 反转页面颜色是谷歌扩展,有助于反转页面颜色。 before using invert page color 在使用反转页面颜色之前

after using invert page color 使用反转页面颜色后

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM