pmotools.utils.color_text module

class pmotools.utils.color_text.ColorText[source]

Bases: object

A class used to generate colored text on the terminal

static addBGColor(color_code: int) str[source]

Takes a number between 16 and 231 to change the background color of text, gives a bigger range of colors than the regular offered ones

Parameters:

color_code – a code between 16 and 231

Returns:

the escape sequence that changes the background to the given color code

Todo

Add a check to make sure it’s a number between 16 and 231.

static addColor(color_code: int) str[source]

Takes a number between 16 and 231 to change text color, gives a bigger range of colors than the regular offered ones

Parameters:

color_code – a code between 16 and 231

Returns:

the escape sequence that changes the text to the given color code

Todo

Add a check to make sure it’s a number between 16 and 231.

black = '\x1b[30m'
blue = '\x1b[34m'
bold = '\x1b[1m'
static boldBlack(t: str) str[source]

Create a bolded black text

Parameters:

t – the text

Returns:

the text but with terminal escape characters to bold and make the text black

static boldBlue(t: str) str[source]

Create a bolded blue text

Parameters:

t – the text

Returns:

the text but with terminal escape characters to bold and make the text blue

static boldGreen(t: str) str[source]

Create a bolded green text

Parameters:

t – the text

Returns:

the text but with terminal escape characters to bold and make the text green

static boldRed(t: str) str[source]

Create a bolded red text

Parameters:

t – the text

Returns:

the text but with terminal escape characters to bold and make the text red

static boldText(t: str) str[source]

Create a bolded text

Parameters:

t – the text

Returns:

the text but with terminal escape characters to bold the text

static boldWhite(t: str) str[source]

Create a bolded white text

Parameters:

t – the text

Returns:

the text but with terminal escape characters to bold and make the text white

cyan = '\x1b[36m'
flashing = '\x1b[5m'
green = '\x1b[32m'
iBlack = '\x1b[90m'
iBlue = '\x1b[94m'
iCyan = '\x1b[96m'
iGreen = '\x1b[92m'
iPurple = '\x1b[95m'
iRed = '\x1b[91m'
iWhite = '\x1b[97m'
iYellow = '\x1b[93m'
invert = '\x1b[7m'
lighten = '\x1b[2m'
on_Black = '\x1b[40m'
on_Blue = '\x1b[44m'
on_Cyan = '\x1b[46m'
on_Green = '\x1b[42m'
on_IBlack = '\x1b[100m'
on_IBlue = '\x1b[104m'
on_ICyan = '\x1b[106m'
on_IGreen = '\x1b[102m'
on_IPurple = '\x1b[105m'
on_IRed = '\x1b[101m'
on_IWhite = '\x1b[107m'
on_IYellow = '\x1b[103m'
on_Purple = '\x1b[45m'
on_Red = '\x1b[41m'
on_White = '\x1b[47m'
on_Yellow = '\x1b[43m'
static outputColors()[source]

Prints out to stdout the colors with their backgrounds so you can see them

Returns:

nothing

purple = '\x1b[35m'
red = '\x1b[31m'
reset = '\x1b[0m'
underline = '\x1b[4m'
white = '\x1b[37m'
yellow = '\x1b[33m'