iPython - 改变双下划线(魔术)属性的颜色?

问题描述 投票:3回答:1

我将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__):

enter image description here

有没有办法在iPython上修改颜色?

我发现了这个问题,但似乎与7.4.0 iPython,给出的答案不再有效。

How do I customize text color in IPython?

python ipython
1个回答
0
投票

您可以覆盖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'
}

这将使洋红色的魔术功能突出显示 - 您的喜好可能会有所不同:)

© www.soinside.com 2019 - 2024. All rights reserved.