Overview
ANSI color utilities provide terminal text formatting using escape codes. These are useful for creating colored output in CLI applications.Constants
Text Styles
Standard Colors
Bright Colors
Helper Functions
red()
Format text in red.green()
Format text in green.yellow()
Format text in yellow.blue()
Format text in blue.magenta()
Format text in magenta.cyan()
Format text in cyan.bold()
Format text in bold.dim()
Format text as dimmed.Usage Examples
Basic Coloring
Status Messages
Using Raw Constants
Formatting Tables
Progress Indicators
Log Levels
Combining Styles
Color Reference
| Function | Color | Use Case |
|---|---|---|
red() | Red | Errors, failures |
green() | Green | Success, completed |
yellow() | Yellow | Warnings, cautions |
blue() | Blue | Info, processing |
magenta() | Magenta | Debug, special |
cyan() | Cyan | Highlights, links |
bold() | Bold | Headers, emphasis |
dim() | Dimmed | Secondary info |
Notes
- All helper functions automatically append
RESETto restore normal formatting - ANSI codes work in most modern terminals
- Colors may not display in all environments (e.g., log files, some CI systems)
- Use
RESETconstant to clear formatting when using raw constants