bumbum-cli
v1.0.1
Published
A TypeScript CLI library for terminal styling and formatting
Downloads
15
Maintainers
Readme
# Terminal Styling Toolkit
A powerful TypeScript library for enhancing terminal applications with beautiful styling and formatting capabilities.
## Installation
```bash
npm i bumbum-cli Features
- 🎨 Text Coloring: Extensive color palette with 24+ named colors
- 📦 Box Formatting: Create beautiful boxes around your text
- 📋 Definition Lists: Format key-value pairs neatly
- 🖥️ Console Utilities: Clear screen and add new lines
- 🦄 Text Styles: Bold, italic, and background colors
- 📘 TypeScript Ready: Full type definitions included
Quick Start
import { box, color, definer, cli } from 'terminal-styling-toolkit';
// Create a colored box
const message = box('Hello World!', {
borderColor: 'green',
backgroundColor: 'black',
padding: 1
});
console.log(message);
// Use colors
console.log(color.red('This is red text'));
console.log(color.green.bold('This is bold green text'));
console.log(color.blue.bg('#FFCC00')('Blue text with yellow background'));
// Console utilities
cli.nl(2); // Add two new lines
cli.clear(); // Clear the consoleAPI Reference
Colors
The library provides 24+ named colors with style modifiers:
// Basic colors
color.red('text')
color.green('text')
color.blue('text')
color.yellow('text')
color.purple('text')
// ... and many more
// Style modifiers
color.red.bold('bold red text')
color.green.italic('italic green text')
color.blue.boldItalic('bold italic blue text')
// Background colors
color.red.bg('#FFFFFF')('red text on white background')
color.green.bg('#000000').bold('bold green text on black background')Available colors: red, redLight, redDark, orange, orangeLight, orangeDark, yellow, yellowLight, gold, green, greenLight, greenDark, blue, blueLight, blueDark, purple, purpleLight, purpleDark, cyan, teal, pink, pinkLight, pinkDark, brown, brownLight, brownDark, lime, limeLight, limeDark, magenta, magentaLight, magentaDark, gray, grayLight, grayDark, black, white.
Box Formatting
Create styled boxes around your text:
box(text: string, options?: BoxOptions): stringOptions:
padding: Object with top, bottom, left, right propertiesmargin: NumberborderStyle: 'single' | 'double' | 'round' | 'bold' | 'singleDouble' | 'doubleSingle' | 'classic'borderColor: Color name or hex valuebackgroundColor: Color name or hex valuealign: 'left' | 'center' | 'right'
Example:
const boxedText = box('Important Message', {
padding: { top: 1, bottom: 1, left: 2, right: 2 },
borderStyle: 'double',
borderColor: 'yellow',
backgroundColor: 'blueDark',
align: 'center'
});Console Utilities
Basic console operations:
cli.nl(count: number = 1): void // Add new lines
cli.clear(): void // Clear consoleTypeScript Support
Full TypeScript definitions are included:
import { BoxOptions, DefinerItem, DefinerOptions, ColorFunction } from 'terminal-styling-toolkit';
const options: BoxOptions = {
borderColor: 'green',
padding: { top: 1, bottom: 1, left: 2, right: 2 }
};
const items: DefinerItem[] = [
{ name: 'Key', value: 'Value' }
];
const redText: ColorFunction = color.red;Examples
Creating a Welcome Message
import { box, color, cli } from 'terminal-styling-toolkit';
cli.clear();
const welcomeMessage = box('Welcome to My CLI App', {
padding: 1,
borderStyle: 'round',
borderColor: 'green',
backgroundColor: 'black',
align: 'center'
});
console.log(color.green.bold(welcomeMessage));
console.log(color.cyan('This is a terminal application with beautiful styling!'));Contributing
We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you have any questions or need help, please open an issue on GitHub.
Made with DETAN for the developer community
