Colors
Use simple and readable color logging utilities in nstypocolors.
nstypocolors provides a set of explicit, single-purpose color functions for logging styled text to the terminal.
These utilities are intentionally designed to be:
- Easy to read in code
- Predictable in output
- Beginner-friendly
- Free from chaining or hidden behavior
Basic Usage
Import only the color functions you need and log directly.
import { logGreen, logRed, logBlue } from 'nstypocolors'
logGreen('Server started successfully')
logRed('Something went wrong')
logBlue('Fetching data...')const { logGreen, logRed, logBlue } = require('nstypocolors')
logGreen('Server started successfully')
logRed('Something went wrong')
logBlue('Fetching data...')Each function prints directly to stdout using ANSI color codes.
Primary Colors
These are the most commonly used colors for general logging.
logRed('Error message')
logGreen('Success message')
logBlue('Information')
logYellow('Warning')
logPink('Highlight')
logMagenta('Debug info')
logCyan('Network log')
logWhite('Plain output')
logBlack('Muted output')logRed('Error message')
logGreen('Success message')
logBlue('Information')
logYellow('Warning')
logPink('Highlight')
logMagenta('Debug info')
logCyan('Network log')
logWhite('Plain output')
logBlack('Muted output')Stick to consistent meanings for colors to improve readability across logs.
Bright Colors
Bright variants are intended for high-attention messages.
logBrightRed('Critical error')
logBrightGreen('Build passed')
logBrightYellow('Attention required')
logBrightBlue('Processing request')
logBrightPink('Important note')
logBrightMagenta('Verbose log')
logBrightCyan('Connected')
logBrightWhite('Output')logBrightRed('Critical error')
logBrightGreen('Build passed')
logBrightYellow('Attention required')
logBrightBlue('Processing request')
logBrightPink('Important note')
logBrightMagenta('Verbose log')
logBrightCyan('Connected')
logBrightWhite('Output')Avoid using bright colors for every log line—they lose impact quickly.
Pastel Colors
Pastel colors are soft, aesthetic, and easy on the eyes—ideal for user-facing tools.
logPastelRed('Soft error')
logPastelPink('Notice')
logPastelBlue('Loading')
logPastelGreen('Ready')
logPastelYellow('Heads up')
logPastelOrange('Reminder')
logPastelLavender('Info panel')
logPastelCoral('Alert')
logPastelMint('Success')logPastelRed('Soft error')
logPastelPink('Notice')
logPastelBlue('Loading')
logPastelGreen('Ready')
logPastelYellow('Heads up')
logPastelOrange('Reminder')
logPastelLavender('Info panel')
logPastelCoral('Alert')
logPastelMint('Success')Pastel colors work especially well for:
- CLI help screens
- Developer tools
- Demo output
- Friendly user feedback
Background Pastel Colors
Background-highlighted variants are useful for labels and banners.
logBackPastelRed('ERROR')
logBackPastelGreen('SUCCESS')
logBackPastelBlue('INFO')
logBackPastelYellow('WARNING')
logBackPastelLavender('NOTE')
logBackPastelMint('OK')logBackPastelRed('ERROR')
logBackPastelGreen('SUCCESS')
logBackPastelBlue('INFO')
logBackPastelYellow('WARNING')
logBackPastelLavender('NOTE')
logBackPastelMint('OK')These are ideal for:
- Status tags
- Section headers
- One-word emphasis
Choosing the Right Style
- Colors → predictable, single-tone logs
- Bright colors → critical attention
- Pastels → friendly or UI-like output
- Gradients → expressive headers or milestones
For expressive, multi-tone output, continue to the Gradients section next.
Last updated on