🖌️ HBH Terminal
Animated terminal text, advanced chalk styling, and dynamic logging for Node.js CLI apps
HBH-Terminal makes your CLI applications more engaging with color animations, typewriter effects, gradients, and dynamic logs. Perfect for CLI tools, scripts, or fun terminal outputs!
Table of Contents
-
- Basic Logging
- Styled Text
- Animated Text
- Typewriter Effect
Installation
1npm install hbh-terminal
or
1yarn add hbh-terminal
Features
✨ Key Features:
- 🎨 Chalk utilities: Hex, RGB, HSL, gradients, rainbow, blinking, random colors
- 🌈 Animations: Hue, RGB, HEX cycling, unified animation mode
- ⌨️ Typewriter effect with cursor, loop, and masking options
- 🖥️ HBHConsole: dynamic, live-updating logs with formatting options
- 📦 Logger: simple & dynamic logging, progress bar support
Modules
HBH-Terminal exposes the following modules:
| Module | Description |
|---|---|
chalk |
Full chalk utilities with chainable colors, gradients, and text effects |
Animations |
Color animations (Color.HUE, Color.RGB, Color.HEX, Color.All) |
Typewriter |
Typewriter text effect |
hbhconsole |
Dynamic logging with live updates and formatting |
logger |
Lightweight logger with dynamic mode and progress bar |
Chalk Utilities
Chalk provides chainable text styles, colors, gradients, and effects.
Examples
1import { chalk } from 'hbh-terminal';3// Basic colors & styles4console.log(chalk.red.bold('🔥 Bold Red'));5console.log(chalk.blue.underline('💧 Underlined Blue'));6console.log(chalk.magenta.italic('💖 Italic Magenta'));8// RGB / HEX / HSL9console.log(chalk.rgb(100, 200, 50)('🌿 Custom RGB'));10console.log(chalk.hex('#ff00ff')('💜 HEX Text'));11console.log(chalk.hsl(200, 100, 50)('💧 HSL Text'));13// Rainbow and gradients14console.log(chalk.rainbow('🌈 Rainbow Text'));15console.log(chalk.bgRainbow('🌈 Background Rainbow'));16console.log(chalk.gradientText('Gradient Text', 'red', 'blue'));
Effects
blinking– text blinksrandom– random colors per characterbgColorize– random background per characteralterNateColor– cycle through an array of colorsalterNateBG– cycle through an array of background colors
Animations
All color animations are under Animations.Color:
1Animations.Color = {2 HUE, // Hue rotation animation3 RGB, // RGB cycling animation4 HEX, // HEX cycling animation5 All // Unified animation with 'hue', 'rgb', 'hex' modes6};
Examples
1import { Animations } from 'hbh-terminal';3// Hue animation4Animations.Color.HUE('Hello World 🌈', { step: 10 });6// RGB cycling7Animations.Color.RGB('RGB Cycling!', { step: 20 });9// HEX cycling10Animations.Color.HEX('HEX Mode 💖', { step: 15 });12// Unified animation13Animations.Color.All('Unified Mode ⚡', { mode: 'rgb', step: 12 });
Configuration Options
| Option | Description |
|---|---|
callback |
Function to render each frame (default: HBHConsole update) |
step |
Increment of color change (default: 5) |
sVal |
Starting color value (default: 0) |
mode |
'hue', 'rgb', 'hex' (for All) |
Typewriter Effects
1import { Animations } from 'hbh-terminal';3Animations.Typewriter.typewriter('Typing this text...', {4 speed: 50,5 loop: 3,6 cursor: '|',7 color: 'magenta',8 eraseOnLoop: true9});
Options
| Option | Description |
|---|---|
speed |
Typing speed in milliseconds (default: 80) |
cursor |
Cursor character (default: '▌') |
loop |
false, number, true, or 'infinite' |
eraseOnLoop |
Erase text between loops (default: false) |
delayBetweenLoops |
Delay in ms between loops (default: 800) |
maskChar |
Masking character like '*' |
color |
Chalk-compatible color |
showCursorAfterDone |
Show cursor after typing ends |
callback |
Function to render each frame (default: HBHConsole update) |
onDone |
Callback when typing completes |
HBHConsole
Dynamic console with live updates, prefix, suffix, and styling.
1import hbhconsole from 'hbh-terminal';3// Basic logging4hbhconsole.log('Hello world!');5hbhconsole.success('✅ Task completed!');6hbhconsole.warn('⚠️ Warning issued!', { timestamp: true });8// Dynamic update9const logRef = hbhconsole.log('Loading...');10setTimeout(() => logRef.update('Almost done... 🔄'), 2000);12// Clear log13logRef.clear();
Log options:
color– text colorprefix/suffix– optional texttimestamp– add time prefixbold,italic,underline– text effects
Logger
Simple yet dynamic logger with optional live updates:
1import { logger } from 'hbh-terminal';3// Dynamic logs4logger.log('Starting process...');5logger.success('✅ Done!');6logger.warn('⚠️ Check this!');7logger.error('❌ Something went wrong');8logger.simple('Just plain text');10// Progress display11logger.logger.progress(1024, 4096);
Features:
- Symbols for
log,success,warn,error,simple - Live terminal updates in dynamic mode
- Progress bar display (
progress(downloaded, total))
Usage Examples
Basic Logging
1import { hbhconsole } from 'hbh-terminal';3hbhconsole.log('Hello world!');4hbhconsole.success('✅ Success message');
Styled Text
1import { chalk } from 'hbh-terminal';3console.log(chalk.red.bold('Bold Red Text'));4console.log(chalk.rgb(255, 100, 0)('🔥 RGB Styled Text'));5console.log(chalk.gradientText('Gradient Text', 'purple', 'orange'));
Animated Text
1import { Animations } from 'hbh-terminal';3Animations.Color.HUE('Hue Rotation 🌈', { step: 10 });4Animations.Color.RGB('RGB Cycling!', { step: 20 });5Animations.Color.HEX('HEX Animation 💖', { step: 15 });6Animations.Color.All('Unified Mode ⚡', { mode: 'hue', step: 12 });
Typewriter Effect
1import { Animations } from 'hbh-terminal';3Animations.Typewriter.typewriter('Typing animation...', {4 speed: 60,5 loop: 2,6 color: 'cyan',7 cursor: '|',8 eraseOnLoop: true9});
API Reference
chalk
- Chainable colors:
.red,.green,.hex('#ff00ff'),.rgb(r,g,b) - Effects:
.bold,.italic,.underline,.blinking - Gradients:
.gradientText(text, start, end)
Animations.Color
HUE(text, conf)– hue rotationRGB(text, conf)– RGB cyclingHEX(text, conf)– HEX cyclingAll(text, conf)– unified mode (hue,rgb,hex)
Animations.Typewriter
typewriter(text, conf)– typewriter effect with options
hbhconsole
log(),success(),warn(),error(),simple()– formatted logs- Live update:
.update(newMessage) - Clear:
.clear()
logger
log(),success(),warn(),error(),simple()progress(downloaded, total)– live progress bar
License
MIT License – Free for personal and commercial use.