简体   繁体   English

在ipython笔记本中更改字体和背景颜色

[英]Change font & background color in ipython notebook

How to change the C:\\Python32\\Lib\\site-packages\\IPython\\frontend\\html\\notebook\\static\\css file in the iPython notebook directory without destroying the source file? 如何在不破坏源文件的情况下更改iPython notebook目录中的C:\\ Python32 \\ Lib \\ site-packages \\ IPython \\ frontend \\ html \\ _ notebook \\ static \\ css文件?

I just want to have a black background in the notebook, and then have orange text colors with blue or whatever for classes and functions. 我只是想在笔记本中有一个黑色背景,然后有橙色文本颜色与蓝色或任何类和功能。

Can anyone help in this one? 这个人可以帮忙吗? I know where to find the source files but not how to modify them. 我知道在哪里可以找到源文件但不知道如何修改它们。

I appreciate any answers. 我很感激任何答案。 Thanks everybody. 谢谢大家。

You can use a file named custom.css in <ipython profile dir>/profile_<profilename>/static/custom/custom.css that will be applied to your notebook. 您可以在<ipython profile dir>/profile_<profilename>/static/custom/custom.css中使用名为custom.css的文件,该文件将应用于您的笔记本。 Browser caching might be aggressive, you might need to force refresh a few times. 浏览器缓存可能很激进,您可能需要强制刷新几次。

Coloring of words is done through codemirror , which supports theming. 单词的着色是通过支持主题的codemirror完成的。 Changing this will be slightly more involved and might require some JavaScript injection in <ipython profile dir>/profile_<profilename>/static/custom/custom.js . 更改这一点将涉及更多,可能需要在<ipython profile dir>/profile_<profilename>/static/custom/custom.js注入一些JavaScript。

I wrote a more detailed, but outdated, explanation which can probably be adapted to new versions. 我写了一个更详细但过时的解释 ,可能适用于新版本。

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

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