Skip to content

Color

A collection of functions that add color to console-printed strings.

These functions work by adding pre-defined ANSI escape codes from the colorama library to the beginning and end of the given string. The escape code characters are interpreted by the console as instructions to display the enclosed text in a specific color/style.

Example - Printing rainbow-colored text 🏳️‍🌈

Python Console Session
>>> from botstrap import Color
>>> print(
...     f"{Color.pink('P')}{Color.red('R')}{Color.yellow('I')}"
...     f"{Color.green('D')}{Color.cyan('E')}{Color.blue('!')}"
... )

blue(text: str) -> str classmethod

Returns a copy of the string with extra characters to color it blue.

Colors the text blue.

cyan(text: str) -> str classmethod

Returns a copy of the string with extra characters to color it cyan.

Colors the text cyan.

green(text: str) -> str classmethod

Returns a copy of the string with extra characters to color it green.

Colors the text green.

grey(text: str) -> str classmethod

Returns a copy of the string with extra characters to color it grey.

Colors the text grey.

pink(text: str) -> str classmethod

Returns a copy of the string with extra characters to color it pink.

Colors the text pink.

red(text: str) -> str classmethod

Returns a copy of the string with extra characters to color it red.

Colors the text red.

yellow(text: str) -> str classmethod

Returns a copy of the string with extra characters to color it yellow.

Colors the text yellow.