Sunday, August 23, 2020

Configuring Custom ipython Terminal Color Scheme

In some cases ipython default terminal color scheme is not the most readable one, especially when using Powershell in Windows. One of the way to fix the problem is to use custom/non-default color scheme. The steps to accomplish that as follows (tested in ipython v7.17 and python 3.7.9):

  1.  Run `pygmentize -L styles` in your terminal to check available ipython color styles/schemes. Experiment with the color scheme by starting ipython while settting the color scheme as one of its starting parameter, for example: ipython TerminalInteractiveShell.highlighting_style=native. Replace native with the color scheme that you want to test. ipython should start with the color scheme that you specify.
  2. Create default ipython configuration file for the current user by running: `ipython profile create` , just use the default configuration file. See: for more in depth explanation of this command. 
  3. Edit the default configuration file located at: ~/.ipython/profile_default/ In Windows, this file is located at: C:\Users\[username]\.ipython\profile_default\  Open the file and edit the line that contain c.TerminalInteractiveShell.highlighting_style parameter. Set this config value to the color scheme that you want to make permanent. For example, in my config, I set the value to 'native' as follows: c.TerminalInteractiveShell.highlighting_style = 'native'. This will apply the 'native' color scheme as the default color scheme when you start ipython. 
The result of this configuration changes in my Powershell is shown below.

Post a Comment

No comments: