Colore Textos

Simple module to color texts on command line output.

@author: João Vitor Gutkoski Paes

class ossom.utils.ColorStr(font: str = 'clear', back: str = 'clear')[source]

Color string

__init__(font: str = 'clear', back: str = 'clear') → None[source]

Pintor de linhas.

Example use:

>>> black_on_white_str = ColorStr("black", "white")
>>> red_on_green_str = ColorStr("red", "green")
>>> print(black_on_white_str("Estou usando colore.ColorStr"))
>>> print(red_on_green_str("I'm using colore.ColorStr"))
Parameters:
  • font (str, optional) – Cor da fonte | Font color. Defaults to “clear”.
  • back (str, optional) – Cor do fundo | Background color. Defaults to “clear”.
Returns:

None.

__call__(text: str = None) → str[source]

Paint the text with its font and backgroud colors.

Parameters:text (str, optional) – The text to be painted. Defaults to None.
Returns:Colored text and background.
Return type:str
fntclr

Font color.

font

Alias for fntclr.

bgrclr

Background color.

background

Alias for bgrclr.

back

Alias for bgrclr.