Recent versions of IPython use Prompt_toolkit, which provide colors via Pygments. YOu need to pass an option to IPython to select the “theme”, you’ll the following.
If You issue ipython --help
Choices: ['Neutral', 'NoColor', 'LightBG', 'Linux']
Set the color scheme (NoColor, Neutral, Linux, or LightBG).
meaning you can either pass the --colors flag or set the c.InteractiveShell.colors=... in your config.
You will also find the following option if you issue a In: %config TerminalInteractiveShell:
The name or class of a Pygments style to use for syntax highlighting. To see
available styles, run `pygmentize -L styles`.
That controls the theme highlighting of IPython. (use --TerminalInteractiveShell.highlighting_style=... at the prompt , or set c.TerminalInteractiveShell.highlighting_style-... in a config file).
Keep in ind the the escape control sequences used to show color may not be compatible with all terminal emulators, and that some part of IPython (in particular tracebacks) do not respect the themes (yes we know and we are planning to fix that at some point but it’s quite a bit of code to refactor).
Keep in mind also that there are 2 types of colors with ANSI code. “True color” that is to say you tell the terminal emulator the R,G,B values of a character, and “short colors”. Where you tell the terminal emulator that the color of the character is one of 8 predefined colors. These 8 predefined colors depends on the terminal emulator itself and can sometime be changed from the terminal emulator preferences. See wikipedia for example of changes in colors.