我将iPython更新为:
Python 3.6.7 (default, Mar 29 2019, 10:38:28)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
我注意到,双下划线属性喜欢__name__
有深蓝色。我的终端是黑色的,所以这些属性是荒谬的黑暗,很难看到(看看A.__name__
):
有没有办法在iPython上修改颜色?
我发现了这个问题,但似乎与7.4.0
iPython,给出的答案不再有效。
您可以覆盖pygments
中定义的任何标记的突出显示颜色 - pymgents documentation中有一个列表。您要更改的令牌是Name.Function.Magic
。为此,请将以下内容添加到ipython_config.py
文件中(我的文件位于~/.ipython/profile_default
中):
from pygments.token import Token
c.TerminalInteractiveShell.highlighting_style_overrides = {
Token.Name.Function.Magic: '#FF00FF'
}
这将使洋红色的魔术功能突出显示 - 您的喜好可能会有所不同:)