Skip to content

How to set a theme? #15197

@klonuo

Description

@klonuo

I first searched the docs and as I couldn't find walkthrough I googled:

how to set gruvbox-dark as default theme

To set gruvbox-dark as your permanent default theme in IPython, you need to modify your configuration file.
As of IPython 9.0+, the theme system has been unified. Add or uncomment the following line in your ipython_config.py:

c.TerminalInteractiveShell.theme_name = 'gruvbox-dark'

If you are on an older version of IPython (pre-9.0), you may need to set the highlighting_style instead:

c.TerminalInteractiveShell.highlighting_style = 'gruvbox-dark'

I use Ipython 9.13 and got error about the theme you suggested: [TerminalIPythonApp] WARNING | Config option theme_name not recognized by TerminalInteractiveShell.

In IPython 9.x, the configuration option theme_name was introduced specifically for the TerminalIPythonApp class, rather than TerminalInteractiveShell. [1, 2] 
To fix the "Config option not recognized" error in your ipython_config.py, change the class prefix from TerminalInteractiveShell to TerminalIPythonApp:

c.TerminalIPythonApp.theme_name = 'gruvbox-dark'

[TerminalIPythonApp] WARNING | Config option theme_name not recognized by TerminalIPythonApp

The error occurs because IPython 9.13 (and the 9.x series) [renamed several configuration options](https://ipython.readthedocs.io/en/9.0.2/config/details.html) during the transition to the new theme system. While the command-line flag is --theme, the configuration file parameter for the standard terminal is typically handled by the TerminalInteractiveShell class or its base apps. [1] 
If both TerminalIPythonApp and TerminalInteractiveShell are failing to recognize theme_name, try these two standard methods for IPython 9.x:

In many 9.x builds, the theme is still technically mapped through the high-level highlighting configuration. Try adding this to your ipython_config.py:

c.TerminalInteractiveShell.highlighting_style = 'gruvbox-dark'

..\IPython\terminal\interactiveshell.py:356: UserWarning: highlighting_style is deprecated since 9.0 and have no effect, use themeing.

To fix this in IPython 9.13, you must use the updated [theme configuration system](https://ipython.readthedocs.io/en/9.0.1/config/details.html) which replaces the now-deprecated highlighting_style. [1, 2] 
The theme_name attribute was recently added to the InteractiveShell class to unify color handling. Update your ipython_config.py with this exact line: [3] 

c.InteractiveShell.theme_name = 'gruvbox-dark'

To complete the loop with Google assistant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions