Skip to content

Text Effects and Styling#

Full Text Functions#

Examples#

In addition to colors, Colorist can also add effects when you print text in the terminal. How to print a full line of text with effects:

Python
from colorist import effect_blink

effect_blink("This is BLINKING!")

How it appears in the terminal:

% This is BLINKING!

Mixing Effects and Colors#

This can also be combined with an optional color:

Python
from colorist import Color, effect_blink

effect_blink("CYAN and BLINKING!", Color.CYAN)

How it appears in the terminal:

% CYAN and BLINKING!

Overview#

Effect Full Text Function Example
Bold effect_bold("text") This is BOLD
Dim effect_dim("text") This is DIMMED
Underline effect_underline("text") This is UNDERLINED
Blink effect_blink("text") This is BLINKING
Reverse effect_reverse("text") This is REVERSED
Hide effect_hide("text") This is HIDDEN

Custom String Styling#

Examples#

How to customize terminal messages and change effect inside a paragraph:

Python
from colorist import Effect

print(f"I want {Effect.UNDERLINE}underlined text{Effect.UNDERLINE_OFF}")

print(f"I want {Effect.BOLD}emphasized text{Effect.BOLD_OFF}")

How it appears in the terminal:

% I want underlined text
% I want emphasized text

Mixing Effects and Colors#

Effects can also be mixed with colors:

Python
from colorist import Color, Effect

print(f"I want both {Color.RED}colored and {Effect.BLINK}blinking{Effect.BLINK_OFF} text{Color.OFF} inside this paragraph")

How it appears in the terminal:

% I want both colored and blinking text inside this paragraph

Tip

Similar to Color.OFF, remember to turn off an effect with the relevant reset option (e.g Effect.BOLD_OFF, Effect.DIM_OFF, etc. or even just Effect.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.

Overview#

Effect Custom Reset Example
Bold Effect.BOLD Effect.BOLD_OFF This is BOLD
Dim Effect.DIM Effect.DIM_OFF This is DIMMED
Underline Effect.UNDERLINE Effect.UNDERLINE_OFF This is UNDERLINED
Blink Effect.BLINK Effect.BLINK_OFF This is BLINKING
Reverse Effect.REVERSE Effect.REVERSE_OFF This is REVERSED
Hide Effect.HIDE Effect.HIDE_OFF This is HIDDEN
- - Effect.OFF -