Python – iPython – Change the color of the double underline (magic) attribute?

iPython – Change the color of the double underline (magic) attribute?… here is a solution to the problem.

iPython – Change the color of the double underline (magic) attribute?

I updated iPython to:

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.

I noticed that double underline properties like __name__ have dark blue. My terminal is black, so those properties are very dark and hard to see (see A.__name__):

enter image description here

Is there a way to modify the color ?.. on iPython

I found this issue but it seems that in 7.4.0 iPython the answer given no longer works.

How do I customize text color in IPython?

Solution

Look at your installation directory and you will find a file named ipython_config.py. To install this file, simply use the following command:

ipython profile create

Otherwise, locate this file and copy it to your ~/.ipython/profile_default/ directory.

Before editing it, back up this file as follows:

cp ~/.ipython/profile_default/ipython_config.py \   
   ~/.ipython/profile_default/ipython_config.py_backup

Open this file with the editor of your choice, search for the following settings and comment them out (remove the “#”):

#c.TerminalInteractiveShell.highlighting_style_overrides = {}

You have to have the next code there:

## Override highlighting format for specific tokens

from pygments.token import Name
c.TerminalInteractiveShell.highlighting_style_overrides = {
   Name.Variable:    "#FF00FF"
}

enter image description here

Related Problems and Solutions