@satyajit_me/console-styler
v1.0.1
Published
Beautiful console output with colors, tables, progress bars, and spinners
Maintainers
Readme
Console Styler
Beautiful console output with colors, tables, progress bars, and spinners.
Installation
npm install console-stylerUsage
import { red, green, bold, success, table, Spinner } from 'console-styler';API
Colors
red('Error message')
green('Success!')
yellow('Warning')
blue('Info')
magenta('Special')
cyan('Highlight')
gray('Muted')
// Custom color
color('text', 'brightBlue')Styles
bold('Bold text')
dim('Dimmed text')
italic('Italic text')
underline('Underlined text')Status Messages
success('Operation completed') // ✓ green
error('Something failed') // ✗ red
warning('Be careful') // ⚠ yellow
info('FYI') // ℹ blueTables
const data = [
{ name: 'John', age: 30, city: 'NYC' },
{ name: 'Jane', age: 25, city: 'LA' }
];
printTable(data);
// ┌────────┬─────┬──────┐
// │ name │ age │ city │
// ├────────┼─────┼──────┤
// │ John │ 30 │ NYC │
// │ Jane │ 25 │ LA │
// └────────┴─────┴──────┘Progress Bar
progressBar(50, 100)
// [████████████████████░░░░░░░░░░░░░░░░░░░░] 50%
progressBar(75, 100, { width: 20, showPercent: false })
// [███████████████░░░░░]Spinner
const spinner = new Spinner({ message: 'Loading...' });
spinner.start();
// After operation
spinner.succeed('Done!');
// or
spinner.fail('Failed');Boxes
printBox('Hello World!', { title: 'Message', borderColor: 'cyan' });
// ╭─── Message ───╮
// │ │
// │ Hello World! │
// │ │
// ╰───────────────╯Dividers
printDivider() // ──────────────────────────────────────────────────
printDivider('═', 30, 'blue')License
MIT
