在 IPython Notebook 中更改所选代码的背景颜色

rkj*_*983 1 css jupyter-notebook

我在n Notebook上使用Base16 Ocean 深色主题IPytho

选中文本的背景色对比不是很好,很难判断它是否被选中:

在此处输入图片说明

在默认设置下,这不会发生:

在此处输入图片说明

请让我知道如何将IPythonNotebook上所选代码的背景颜色更改为更清晰的背景颜色。

小智 6

如果您还不知道,请在笔记本中运行以下代码以查找系统上的 jupyter 配置文件夹:

from jupyter_core.paths import jupyter_config_dir
jupyter_dir = jupyter_config_dir()
print(jupyter_dir)
Run Code Online (Sandbox Code Playgroud)

在jupyter config文件夹中,找到/custom/custom.css,修改如下一行:

.cm-s-ipython div.CodeMirror-selected {background: #384151 !important;}
Run Code Online (Sandbox Code Playgroud)

我在这里使用'#3366ff',您可以使用适合您需要的任何背景颜色。