Search code examples
terminalipythoniterm2

How can I change the color of iTerm2 on IPython shell?


I want to change the color of my IPython shell on iTerm2, but athough I can change the color of the iTerm2, I could not change the content of the IPython shell.

The iTerm2 color can be changed from Preferences | Profiles | Window, but whatever color scheme I choose does not change the color of the IPython shell, for example import or try keyword.

So I think it is decided in other places. How can I change the color of the IPython shell?


Solution

  • Change it through TerminalInteractiveShell.highlighting_style. I set the following to my ipython_config.py:

    c.InteractiveShell.colors = "Linux"
    c.TerminalInteractiveShell.highlighting_style = "vim"
    

    The available colors for TerminalInteractiveShell.highlighting_style can be obtained with the following code:

    import pygments
    list(pygments.styles.get_all_styles())