How to Add Effects and Styling to Text#
Full Line 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:
How it appears in the terminal:
% This is BLINKING!
Mixing Effects and Colors#
This can also be combined with an optional color:
How it appears in the terminal:
% CYAN and BLINKING!
Cheat Sheet#
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 | |
---|---|
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 | |
---|---|
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.
Cheat Sheet#
Effect | Effect Code | Reset Code | 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 | - |