Skip to content

Custom String Styling for Background Colors#

BgColor#

Enumerable class of all available standard background colors.

Options:

Color Color Code Example
Green BgColor.GREEN This is GREEN background!
Yellow BgColor.YELLOW This is YELLOW background!
Red BgColor.RED This is RED background!
Magenta BgColor.MAGENTA This is MAGENTA background!
Blue BgColor.BLUE This is BLUE background!
Cyan BgColor.CYAN This is CYAN background!
White BgColor.WHITE This is WHITE background!
Black BgColor.BLACK This is BLACK background!
- BgColor.DEFAULT -
- BgColor.OFF -

Example:

Example
Python
1
2
3
4
5
from colorist import BgColor

print(f"I want {BgColor.RED}red{BgColor.OFF} background color inside this paragraph")

print(f"Both {BgColor.GREEN}green{BgColor.OFF} and {BgColor.YELLOW}yellow{BgColor.OFF} are nice background colors")

How it appears in the terminal:

% I want red background color inside this paragraph
% Both green and yellow are nice background colors

Tip

Remember to turn off a color with BgColor.OFF or BgBrightColor.OFF every time you want to revert back to the default terminal text style. Otherwise, the effect may spill over and into other terminal messages.

BgBrightColor#

Enumerable class of all available standard bright background colors.

Options:

Color Color Code Example
Bright green BgBrightColor.GREEN This is BRIGHT GREEN background!
Bright yellow BgBrightColor.YELLOW This is BRIGHT YELLOW background!
Bright red BgBrightColor.RED This is BRIGHT RED background!
Bright magenta BgBrightColor.MAGENTA This is BRIGHT MAGENTA background!
Bright blue BgBrightColor.BLUE This is BRIGHT BLUE background!
Bright cyan BgBrightColor.CYAN This is BRIGHT CYAN background!
Bright white BgBrightColor.WHITE This is BRIGHT WHITE background!
Bright black BgBrightColor.BLACK This is BRIGHT BLACK background!
- BgBrightColor.DEFAULT -
- BgBrightColor.OFF -

Example:

Example
Python
1
2
3
from colorist import BgBrightColor

print(f"I want {BgBrightColor.CYAN}cyan{BgBrightColor.OFF} background color inside this paragraph")

How it appears in the terminal:

% I want cyan background color inside this paragraph