如何在 IPython shell 上更改 iTerm2 的颜色?

How can I change the color of iTerm2 on IPython shell?

我想在 iTerm2 上更改 IPython shell 的颜色,但是虽然我可以更改 iTerm2 的颜色,但我无法更改 IPython 的内容shell.

iTerm2 的颜色可以从首选项中更改 |概况 | Window,但是我选择的任何配色方案都不会改变 IPython shell 的颜色,例如 importtry 关键字。

所以我觉得是其他地方决定的。如何更改 IPython shell 的颜色?

改成TerminalInteractiveShell.highlighting_style。我将以下内容设置为我的 ipython_config.py:

c.InteractiveShell.colors = "Linux"
c.TerminalInteractiveShell.highlighting_style = "vim"

TerminalInteractiveShell.highlighting_style可用颜色可通过以下代码获取:

import pygments
list(pygments.styles.get_all_styles())