How to Print Foreground Text Colors#
Introduction#
When you want to print colored text in the terminal, Colorist offers two ways of doing so:
- Full text functions: Print a full line of colored text with the
green(),yellow(),red(), etc. functions. - Custom string styling: Mix colors to any part of a string with the
ColorandBrightColorclasses.
Print Line of Colored Text#
How to print a full line of colored text in the terminal:
| Python | |
|---|---|
1 2 3 4 5 | |
How it appears in the terminal:
% This is GREEN!
% This is YELLOW!
% This is RED! Refer to the documetation for a complete list of color options.
Print Mixed Colors in Text#
How to customize colors inside a paragraph and print it in the terminal:
| Python | |
|---|---|
1 2 3 4 5 | |
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.
Bright Colors#
Most terminals support bright colors that stand more out:
| Python | |
|---|---|
1 2 3 | |
How it appears in the terminal:
% Put CYAN inside this paragraph Refer to the documetation for a complete list of color options for custom text styling.
Cheat Sheets#
Normal Colors#
| Color | Color Code | Example |
|---|---|---|
![]() | Color.GREEN | This is GREEN! |
![]() | Color.YELLOW | This is YELLOW! |
![]() | Color.RED | This is RED! |
![]() | Color.MAGENTA | This is MAGENTA! |
![]() | Color.BLUE | This is BLUE! |
![]() | Color.CYAN | This is CYAN! |
![]() | Color.WHITE | This is WHITE! |
![]() | Color.BLACK | This is BLACK! |
| - | Color.DEFAULT | - |
| - | Color.OFF | - |
Bright Colors#
| Color | Color Code | Example |
|---|---|---|
![]() | BrightColor.GREEN | This is BRIGHT GREEN! |
![]() | BrightColor.YELLOW | This is BRIGHT YELLOW! |
![]() | BrightColor.RED | This is BRIGHT RED! |
![]() | BrightColor.MAGENTA | This is BRIGHT MAGENTA! |
![]() | BrightColor.BLUE | This is BRIGHT BLUE! |
![]() | BrightColor.CYAN | This is BRIGHT CYAN! |
![]() | BrightColor.WHITE | This is BRIGHT WHITE! |
![]() | BrightColor.BLACK | This is BRIGHT BLACK! |
| - | BrightColor.DEFAULT | - |
| - | BrightColor.OFF | - |















