Manual Colors
When you need more control than semantic methods provide, use manual color functions to style text exactly how you want.
Basic Color Method
log.color(message, color)
Apply any color to your text:
// Named colors
log.color('Red text', 'red');
log.color('Blue text', 'blue');
log.color('Cyan text', 'cyan');
// HEX colors
log.color('Custom purple', '#9b59b6');
log.color('Brand color', '#ff6b6b');
// RGB colors
log.color('RGB green', 'rgb(46, 204, 113)');
log.color('RGB blue', 'rgb(52, 152, 219)');
Output
Red text
Blue text
Cyan text
Custom purple
Brand color
RGB green
RGB blue
🎮 Try Colors
Named Colors
All standard terminal colors are supported:
Basic Colors
| Color | Example |
|---|---|
black | log.color('text', 'black') |
red | log.color('text', 'red') |
green | log.color('text', 'green') |
yellow | log.color('text', 'yellow') |
blue | log.color('text', 'blue') |
magenta | log.color('text', 'magenta') |
cyan | log.color('text', 'cyan') |
white | log.color('text', 'white') |
gray / grey | log.color('text', 'gray') |
Basic Colors
black | red | green | yellow
blue | magenta | cyan | white | gray
Bright Colors
| Color | Example |
|---|---|
brightRed | log.color('text', 'brightRed') |
brightGreen | log.color('text', 'brightGreen') |
brightYellow | log.color('text', 'brightYellow') |
brightBlue | log.color('text', 'brightBlue') |
brightMagenta | log.color('text', 'brightMagenta') |
brightCyan | log.color('text', 'brightCyan') |
Bright Colors
brightRed | brightGreen | brightYellow
brightBlue | brightMagenta | brightCyan
HEX Colors
Use any 3 or 6 digit HEX color:
// 6-digit HEX
log.color('Tomato red', '#ff6347');
log.color('Steel blue', '#4682b4');
log.color('Gold', '#ffd700');
// 3-digit HEX (shorthand)
log.color('Red', '#f00');
log.color('Lime', '#0f0');
log.color('Blue', '#00f');
HEX Colors
Tomato red
Steel blue
Gold
Red | Lime | Blue
🎮 Try Brand Colors
Popular HEX Colors
// Brand colors
log.color('GitHub', '#333333');
log.color('Twitter', '#1da1f2');
log.color('Slack', '#4a154b');
log.color('Discord', '#5865f2');
// Status colors
log.color('Success', '#28a745');
log.color('Warning', '#ffc107');
log.color('Danger', '#dc3545');
log.color('Info', '#17a2b8');
Brand & Status Colors
GitHub | Twitter | Slack | Discord
Success | Warning | Danger | Info
RGB Colors
Full RGB support for precise color control:
// Standard RGB format
log.color('Custom green', 'rgb(46, 204, 113)');
log.color('Custom blue', 'rgb(52, 152, 219)');
log.color('Custom orange', 'rgb(230, 126, 34)');
RGB Colors
Custom green
Custom blue
Custom orange
RGB Examples
// Pastel palette
log.color('Pastel pink', 'rgb(255, 182, 193)');
log.color('Pastel blue', 'rgb(173, 216, 230)');
log.color('Pastel green', 'rgb(152, 251, 152)');
// Neon palette
log.color('Neon pink', 'rgb(255, 16, 240)');
log.color('Neon green', 'rgb(57, 255, 20)');
log.color('Neon blue', 'rgb(77, 77, 255)');
Pastel & Neon
Pastel pink | Pastel blue | Pastel green
Neon pink | Neon green | Neon blue
Background Colors
log.bg(text, textColor, bgColor)
Apply both text and background colors:
// Named colors
log.bg(' SUCCESS ', 'white', 'green');
log.bg(' ERROR ', 'white', 'red');
log.bg(' WARNING ', 'black', 'yellow');
// HEX colors
log.bg(' CUSTOM ', '#ffffff', '#9b59b6');
Background Colors
SUCCESSERRORWARNINGCUSTOM
🎮 Try Badges
Common Badge Examples
// Status badges
log.bg(' PASS ', 'white', 'green');
log.bg(' FAIL ', 'white', 'red');
log.bg(' SKIP ', 'black', 'yellow');
log.bg(' TODO ', 'white', 'blue');
// Environment badges
log.bg(' DEV ', 'white', '#3498db');
log.bg(' STAGING ', 'black', '#f39c12');
log.bg(' PROD ', 'white', '#e74c3c');
// Priority badges
log.bg(' P0 ', 'white', '#e74c3c');
log.bg(' P1 ', 'white', '#e67e22');
log.bg(' P2 ', 'black', '#f1c40f');
log.bg(' P3 ', 'white', '#3498db');
Badge Examples
PASSFAILSKIPTODO
DEVSTAGINGPROD
P0P1P2P3
Highlighting Text
log.highlight(text, search, color)
Highlight specific words or patterns within text:
// Highlight a word
log.highlight('User John logged in from New York', 'John', 'cyan');
// Highlight multiple occurrences
log.highlight('The quick brown fox jumps over the lazy fox', 'fox', 'yellow');
Highlighted Text
User John logged in from New York
The quick brown fox jumps over the lazy fox
🎮 Try Highlighting
Practical Examples
Colorful Logging Function
function colorLog(level, message, data) {
const colors = {
debug: 'gray',
info: 'cyan',
success: 'green',
warn: 'yellow',
error: 'red'
};
log.color(`[${level.toUpperCase()}] ${message}`, colors[level]);
if (data) {
log.color(JSON.stringify(data, null, 2), 'gray');
}
}
colorLog('info', 'Server started', { port: 3000 });
colorLog('success', 'Database connected');
colorLog('error', 'Request failed', { code: 500 });
Custom Logging
ℹ[INFO] Server started
{ "port": 3000 }
✔[SUCCESS] Database connected
✖[ERROR] Request failed
{ "code": 500 }
🎮 Try Custom Logging
Next: Style Builder →