ColorANSI

Module: ColorANSI

Inheritance diagram for IPython.ColorANSI:

Tools for coloring text in ANSI terminals.

Classes

ColorScheme

class IPython.ColorANSI.ColorScheme(_ColorScheme__scheme_name_, colordict=None, **colormap)

Generic color scheme class. Just a name and a Struct.

__init__()
copy()

Return a full copy of the object, optionally renaming it.

ColorSchemeTable

class IPython.ColorANSI.ColorSchemeTable(scheme_list=None, default_scheme='')

Bases: dict

General class to handle tables of color schemes.

It’s basically a dict of color schemes with a couple of shorthand attributes and some convenient methods.

active_scheme_name -> obvious active_colors -> actual color table of the active scheme

__init__()

Create a table of color schemes.

The table can be created empty and manually filled or it can be created with a list of valid color schemes AND the specification for the default active scheme.

add_scheme()

Add a new color scheme to the table.

copy()

Return full copy of object

set_active_scheme()

Set the currently active scheme.

Names are by default compared in a case-insensitive way, but this can be changed by setting the parameter case_sensitive to true.

InputTermColors

class IPython.ColorANSI.InputTermColors

Color escape sequences for input prompts.

This class is similar to TermColors, but the escapes are wrapped in  and  so that readline can properly know the length of each line and can wrap lines accordingly. Use this class for any colored text which needs to be used in input prompts, such as in calls to raw_input().

This class defines the escape sequences for all the standard (ANSI?) colors in terminals. Also defines a NoColor escape which is just the null string, suitable for defining ‘dummy’ color schemes in terminals which get confused by color escapes.

This class should be used as a mixin for building color schemes.

Black = '\x01\x1b[0;30m\x02'
BlinkBlack = '\x01\x1b[5;30m\x02'
BlinkBlue = '\x01\x1b[5;34m\x02'
BlinkCyan = '\x01\x1b[5;36m\x02'
BlinkGreen = '\x01\x1b[5;32m\x02'
BlinkLightGray = '\x01\x1b[5;37m\x02'
BlinkPurple = '\x01\x1b[5;35m\x02'
BlinkRed = '\x01\x1b[5;31m\x02'
BlinkYellow = '\x01\x1b[5;33m\x02'
Blue = '\x01\x1b[0;34m\x02'
Brown = '\x01\x1b[0;33m\x02'
Cyan = '\x01\x1b[0;36m\x02'
DarkGray = '\x01\x1b[1;30m\x02'
Green = '\x01\x1b[0;32m\x02'
LightBlue = '\x01\x1b[1;34m\x02'
LightCyan = '\x01\x1b[1;36m\x02'
LightGray = '\x01\x1b[0;37m\x02'
LightGreen = '\x01\x1b[1;32m\x02'
LightPurple = '\x01\x1b[1;35m\x02'
LightRed = '\x01\x1b[1;31m\x02'
NoColor = ''
Normal = '\x01\x1b[0m\x02'
Purple = '\x01\x1b[0;35m\x02'
Red = '\x01\x1b[0;31m\x02'
White = '\x01\x1b[1;37m\x02'
Yellow = '\x01\x1b[1;33m\x02'

TermColors

class IPython.ColorANSI.TermColors

Color escape sequences.

This class defines the escape sequences for all the standard (ANSI?) colors in terminals. Also defines a NoColor escape which is just the null string, suitable for defining ‘dummy’ color schemes in terminals which get confused by color escapes.

This class should be used as a mixin for building color schemes.

Black = '\x1b[0;30m'
BlinkBlack = '\x1b[5;30m'
BlinkBlue = '\x1b[5;34m'
BlinkCyan = '\x1b[5;36m'
BlinkGreen = '\x1b[5;32m'
BlinkLightGray = '\x1b[5;37m'
BlinkPurple = '\x1b[5;35m'
BlinkRed = '\x1b[5;31m'
BlinkYellow = '\x1b[5;33m'
Blue = '\x1b[0;34m'
Brown = '\x1b[0;33m'
Cyan = '\x1b[0;36m'
DarkGray = '\x1b[1;30m'
Green = '\x1b[0;32m'
LightBlue = '\x1b[1;34m'
LightCyan = '\x1b[1;36m'
LightGray = '\x1b[0;37m'
LightGreen = '\x1b[1;32m'
LightPurple = '\x1b[1;35m'
LightRed = '\x1b[1;31m'
NoColor = ''
Normal = '\x1b[0m'
Purple = '\x1b[0;35m'
Red = '\x1b[0;31m'
White = '\x1b[1;37m'
Yellow = '\x1b[1;33m'

Function

IPython.ColorANSI.make_color_table()

Build a set of color attributes in a class.

Helper function for building the *TermColors classes.

Table Of Contents

Previous topic

The IPython API

Next topic

ConfigLoader

This Page