Skip to content

Custom String Styling for Foreground Text Colors#

Color#

Enumerable class of all available standard text colors.

Options:

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

Example:

Example
Python
1
2
3
4
5
from colorist import Color

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

print(f"Both {Color.GREEN}GREEN{Color.OFF} and {Color.YELLOW}YELLOW{Color.OFF} are nice colors")

How it appears in the terminal:

% I want RED color inside this paragraph
% Both GREEN and YELLOW are nice colors

Tip

Remember to turn off a color with Color.OFF or BrightColor.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.

BrightColor#

Enumerable class of all available standard bright text colors.

Options:

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

Example:

Example
Python
1
2
3
from colorist import BrightColor

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

How it appears in the terminal:

% I want CYAN color inside this paragraph