ipython: change syntax highlighting color for matching parenthesis

Viewed 364

I am using ipython 5.8.0 on Debian 10

Following screenshot shows the colors of normal command, and a command when my cursor moves to a parenthesis and matching parenthesis are highlighted:

enter image description here

This color scheme is unfortunate. Where can I change this?

3 Answers

You can create ipython profile if not exists and override style

check if ipython_config.py presents under ~/.ipython/profile_default/ if not then you can run this command to create it

ipython profile create

open ipython_config.py file in any editor of your like and uncomment and update this option

from pygments.token import Token
c.TerminalInteractiveShell.highlighting_style_overrides = {
    Token.MatchingBrackets.Other  : '#FF00FF', # nested brackets color
    Token.MatchingBracket.Other   : '#FF00FF', # bracket color
    Token.MatchingBracket.Cursor  : '#4b3588', # on cursor over bracket color
    Token.MatchingBrackets.Cursor : '#4b3588', # on cursor over nested matching brackets color
}

For Build in token check here, for Styling info check here

For how i get to know ipython uses pygments for customization check here

You can create ipython profile if not exists and change theme

check if ipython_config.py presents under ~/.ipython/profile_default/ if not then you can run this command to create it

ipython profile create

open ipython_config.py file in any editor of your like and uncomment and update these options as you like

c.InteractiveShell.color_info = True

c.InteractiveShell.colors = 'Linux'

c.TerminalInteractiveShell.highlighting_style = 'monokai'

c.TerminalInteractiveShell.highlight_matching_brackets = True

In your Terminal, click Edit > Profile Preferences > Colors

See the Text and Background Color. enter image description here

Related