cachai.utilities.strcol

cachai.utilities.strcol(string, c='white')[source]

Applies ANSI color codes to a string (only work in terminal/output cells).

Parameters
stringstr

The string you want to color.

cstr or int

Color to color the string with. This can be a number from the ANSI 8-bit color codes (between 0 and 255) or a string of one of the predefined colors: "white", "black", "light_gray", "dark_gray", "gold", "red", "blue", "green", "magenta", "mint", "orange".

Returns

str

Examples

import cachai.utilities as chu

print(chu.strcol("Magenta text",c="magenta"))
Magenta text