Search code examples
terminalipythoncolor-scheme

ipython: change syntax highlighting color for matching parenthesis


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?

UPDATE:

This solution no longer works for ipython3 version 8.5.0. When I add it to the config, it has no effect


Solution

  • 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