Module termcolors :: Class TermColorsUnix
[hide private]
[frames] | no frames]

Class TermColorsUnix

source code


Unix color scheme.
Instance Methods [hide private]
 
__init__(self, stream=None)
stream - Stream for out colors.
source code
 
_calcColor(self, text_color, text_bright, bg_color, bg_bright)
Calculate color value.
source code
 
_setColor(self, value)
Set specified color from value.
source code
 
_calcResetColor(self)
Calculate value for reset colors to default.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

    Inherited from TermColors
 
_clear(self, save_last=True)
Clear specified colors to None and save to last (if not None).
source code
 
_decode_color(self)
Decode color to value from specified colors.
source code
 
bg(self)
Go to enter background color.
source code
 
black(self)
Set black color.
source code
 
blue(self)
Set blue color.
source code
 
bright(self)
Set bright color.
source code
 
cyan(self)
Set cyan color.
source code
 
dark(self)
Set dark color.
source code
 
green(self)
Set green color.
source code
 
magenta(self)
Set magenta color.
source code
 
red(self)
Set red color.
source code
 
reset(self)
Try reset colors to default.
source code
 
set(self)
Set (apply) all specified colors.
source code
 
set_reset_color(self)
Save specified color to use for reset.
source code
 
txt(self)
Go to enter text color(this is default).
source code
 
white(self)
Set white color.
source code
 
write(self, s, skip=False, stream=None)
Colorized ouput string to stream.
source code
 
writeln(self, s='', skip=False, stream=None)
As write but add new line at end.
source code
 
yellow(self)
Set yellow color.
source code
Class Methods [hide private]
    Inherited from TermColors
 
skipTags(cls, s)
Remove colorize tags from string.
source code
Static Methods [hide private]
    Inherited from TermColors
 
getDefault(stream=None)
Return TermColors instance with default color scheme (initialized for current terminal).
source code
Class Variables [hide private]
    Inherited from TermColors
  C_BLACK = 0
  C_BLUE = 1
  C_CYAN = 3
  C_GREEN = 2
  C_MAGENTA = 5
  C_RED = 4
  C_RE_PATT = '<([rgbkcmyw_RGBKCMYW]{1,2})>((.|\n)*?)</\\1>'
Pattern for search tags.[1]-color string, [2]-string for colorize.
  C_WHITE = 7
  C_YELLOW = 6
Instance Variables [hide private]
    Inherited from TermColors
  _bgbright
Use text bright.
  _cbg
Background color.
  _color_table
Color table.
  _ctxt
Text color.
  _isbg
If true then now set bg colors.
  _last_bgbright
Previous bg brightness.
  _last_cbg
Previous bg color.
  _last_ctxt
Previous text color.
  _last_txtbright
Previous text brightness.
  _recomp
Compiled pattern for RE.
  _reset_value
Color color value or None for use default.
  _stream
stream for out colors.
  _tag_table
Table for match colr strings to color index.
  _txtbright
Use text bright.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, stream=None)
(Constructor)

source code 

stream - Stream for out colors. In windows not used.

Default is None = use sys.stdout.

Overrides: object.__init__
(inherited documentation)

_calcColor(self, text_color, text_bright, bg_color, bg_bright)

source code 

Calculate color value.

text_color - Text color, use class color constant C_xxxxx.

If color argument is None use last value or not use this component if no last. or use default value. See implementation detail.

bg_color - Background color, use class color constant C_xxxxx.

If color argument is None use last value or not use this component if no last. or use default value. See implementation detail.

text_bright - Text brightness,``True`` for bright, False for dark color.

If color argument is None use last value or not use this component if no last. or use default value. See implementation detail.

bg_bright - Background brightness,``True`` for bright, False for dark color.

If color argument is None use last value or not use this component if no last. or use default value. See implementation detail.

Return value for set color. Returned value must be right for use without check.

Overrides: TermColors._calcColor
(inherited documentation)

_setColor(self, value)

source code 

Set specified color from value.

Value must be right. (Not check more).

Overrides: TermColors._setColor

_calcResetColor(self)

source code 
Calculate value for reset colors to default.
Overrides: TermColors._calcResetColor