@buucolors/buucolors
v1.0.0
Published
Zero-dependency console color library - Lightweight alternative to Chalk with pure JavaScript support
Maintainers
Readme
🌟 BuuColors 🌟
🚀 Features
- 🚫 Zero Dependencies - No external dependencies
- 🎯 Pure JavaScript - Works with CommonJS
- ⚡ High Performance - Optimized with intelligent caching
- 🌈 Rich Color Support - Supports named colors, RGB and gradients
- 🎨 40+ Quick Colors - Pre-configured color combinations
- 🔗 Chainable API - Intuitive method chaining
- 🎪 Text Effects - Bold, Italic, Underline and more
- 🌅 Gradient Backgrounds - Dynamic gradient backgrounds
📦 Installation
# Install via npm
npm install @buucolors/buucolors
# Install via yarn
yarn add @buucolors/buucolors
# Install via pnpm
pnpm add @buucolors/buucolors💡 Usage Example
// JavaScript Usage
const buuColors = require('@buucolors/buucolors');
const { quickColors, c1, c2, c3 } = require('@buucolors/buucolors/quick');
// Basic colors
console.log(buuColors.cmdRed('Red text'));
console.log(buuColors.cmdGreen('Green text'));
// Quick Colors
console.log(c1('Purple styled text'));
console.log(c2('Green styled text'));
// Advanced styling
console.log(buuColors.cmdYellow.bg_blue.bold('Complex styling'));
console.log(buuColors.gradientCmd_red2purple('Gradient magic'));
// Basic usage
console.log(buuColors.cmdRed('Hello from 🎨BuuColors🌈!'));
console.log(c1('Quick color styling'));🎨 Basic Colors
const buuColors = require('@buucolors/buucolors');
console.log(buuColors.cmdRed('Red text'));
console.log(buuColors.cmdGreen('Green text'));
console.log(buuColors.cmdBlue('Blue text'));
console.log(buuColors.cmdYellow('Yellow text'));
console.log(buuColors.cmdMagenta('Magenta text'));
console.log(buuColors.cmdCyan('Cyan text'));
console.log(buuColors.cmdWhite('White text'));
console.log(buuColors.cmdBlack('Black text'));✨ Text Effects
const buuColors = require('@buucolors/buucolors');
console.log(buuColors.cmdRed.bold('Bold red text'));
console.log(buuColors.cmdGreen.italic('Italic green text'));
console.log(buuColors.cmdBlue.underline('Underlined blue text'));
console.log(buuColors.cmdYellow.strikethrough('Strikethrough yellow text'));
console.log(buuColors.cmdMagenta.dim('Dimmed magenta text'));
console.log(buuColors.cmdCyan.inverse('Inverted cyan text'));🌈 Background Colors
const buuColors = require('@buucolors/buucolors');
console.log(buuColors.cmdWhite.bg_red('White text on red background'));
console.log(buuColors.cmdBlack.bg_yellow('Black text on yellow background'));
console.log(buuColors.cmdRed.bg_white.bold('Bold red text on white background'));🎯 RGB Colors
const buuColors = require('@buucolors/buucolors');
// Direct RGB usage
console.log(buuColors.cmdRgb(255, 100, 50, 'Custom RGB color'));
// Chainable RGB
console.log(buuColors.cmdRgb(100, 255, 200).bold('Bold custom RGB'));
console.log(buuColors.cmdRgb(255, 0, 128).bg_black('RGB with background'));
// RGB Backgrounds
console.log(buuColors.cmdWhite.bgRgb(50, 100, 200, 'White text on RGB background'));🌅 Gradients
const buuColors = require('@buucolors/buucolors');
// Named color gradients
console.log(buuColors.gradientCmd_red2blue('Red to blue gradient'));
console.log(buuColors.gradientCmd_green2purple.bold('Bold green to purple'));
// RGB gradients
console.log(buuColors.gradientCmdRgb(255, 0, 0, 0, 0, 255, 'RGB gradient'));
// Gradient backgrounds
console.log(buuColors.cmdWhite.gradientBg_red2blue('White text on gradient background'));
console.log(buuColors.cmdBlack.gradientBgRgb(255, 0, 0, 0, 255, 0, 'RGB gradient background'));🎪 Quick Colors
BuuColors includes 40 pre-configured Quick Colors for immediate use:
const { c1, c2, c3, c4, c5, quickColors } = require('@buucolors/buucolors/quick');
console.log(c1('Purple text')); // Purple
console.log(c2('Green text')); // Green
console.log(c3('Blue text')); // Blue
console.log(c4('Red text')); // Red
console.log(c5('Bold bright blue')); // Bold bright blue
console.log(c15('Gradient magic')); // Magenta-purple gradient with blue-black background
console.log(c25('Bright magenta on bright black'));
// Use all Quick Colors
Object.keys(quickColors).forEach(key => {
console.log(quickColors[key](`This is ${key}`));
});🔗 Method Chaining
Combine multiple effects through method chaining:
const buuColors = require('@buucolors/buucolors');
console.log(
buuColors.cmdYellow
.bg_blue
.bold
.underline('Complex styled text')
);
console.log(
buuColors.cmdRgb(255, 100, 180)
.bg_black
.italic
.inverse('RGB with multiple effects')
);📋 Available Colors
Standard Colors
cmdBlack,cmdRed,cmdGreen,cmdYellowcmdBlue,cmdMagenta,cmdCyan,cmdWhitecmdOrange,cmdLime,cmdPurple,cmdBrown
Bright Colors
cmdBrightBlack,cmdBrightRed,cmdBrightGreen,cmdBrightYellow
Text Effects
bold,dim,italic,underline,overlineinverse,hidden,strikethrough,reset
Background Colors
All colors are available as backgrounds with the bg_ prefix:
bg_red,bg_green,bg_blue, etc.bg_bright_red,bg_bright_green, etc.
RGB Colors
cmdRgb(r, g, b, text)- Direct RGB text color with optional textcmdRgb(r, g, b).bold('text')- Chainable RGB text colorbgRgb(r, g, b, text)- RGB background color
Gradient Colors
Named Color Gradients (Text)
gradientCmd_red2blue('text')- Red to blue text gradientgradientCmd_green2purple('text')- Green to purple text gradientgradientCmd_blue2red('text')- Blue to red text gradientgradientCmd_yellow2green('text')- Yellow to green text gradientgradientCmd_magenta2cyan('text')- Magenta to cyan text gradient- And many more color combinations...
RGB Gradients (Text)
gradientCmdRgb(r1, g1, b1, r2, g2, b2, 'text')- Custom RGB text gradient
Named Color Gradients (Background)
gradientBg_red2blue('text')- Red to blue background gradientgradientBg_green2purple('text')- Green to purple background gradientgradientBg_blue2red('text')- Blue to red background gradient- And many more background gradient combinations...
RGB Gradients (Background)
gradientBgRgb(r1, g1, b1, r2, g2, b2, 'text')- Custom RGB background gradient
⚡ Performance
BuuColors is highly optimized for performance:
- Intelligent Caching: Functions are cached for repeated use
- Lazy Loading: Gradient methods are created only when needed
- Zero Dependencies: No external libraries slow down the package
- Benchmark: 1000 color operations in ~10ms
// Performance Test
const start = Date.now();
for (let i = 0; i < 1000; i++) {
buuColors.cmdRed.bold.bg_white('Performance test');
}
console.log(`1000 operations: ${Date.now() - start}ms`);Usage Tips
You can use specific entry points for better organization:
// Only Quick Colors
const { c1, c15, c25 } = require('@buucolors/buucolors/quick');
// Main library for advanced features
const buuColors = require('@buucolors/buucolors');📋 Package Contents
- 📃
index.js- Main library file - 📃
buuQuickColors.js- Quick Colors module - 📁
buuColors/- Core functionality modules - 📖
README.md- This beautiful documentation - 📜
package.json- Package configuration
🤝 Contributing
We welcome contributions! Feel free to:
- 🐛 Report bugs
- 💡 Suggest new features
- 🔧 Contribute improvements
- 🌟 Rate and share the package
📄 License
MIT License - Free and Open Source
This project is licensed under the MIT License, which means you are free to:
- ✅ Use - Use this library in personal and commercial projects
- ✅ Modify - Change and customize the code to fit your needs
- ✅ Distribute - Share and redistribute the library
- ✅ Private Use - Use in private projects without restrictions
- ✅ Commercial Use- Use in commercial applications and products
The only requirement is to include the original copyright notice and license terms.
🌐 Connect with Us
🔥 Examples
Simple Colored Text
const buuColors = require('@buucolors/buucolors');
console.log(buuColors.cmdRed('Error: Something went wrong!'));
console.log(buuColors.cmdGreen('✓ Successfully completed'));
console.log(buuColors.cmdYellow('⚠ Warning: Attention required'));Complex Styling Combinations
const buuColors = require('@buucolors/buucolors');
console.log(
buuColors.cmdWhite
.bg_red
.bold
.underline('CRITICAL ERROR')
);
console.log(
buuColors.gradientCmd_green2blue
.bold
.bg_black('Gradient text with black background')
);Quick Colors for Rapid Development
const { c1, c2, c3, c15, c25, c35 } = require('@buucolors/buucolors/quick');
console.log(c1('Header Text'));
console.log(c2('Success Message'));
console.log(c3('Info Message'));
console.log(c15('Special Gradient Effect'));
console.log(c25('Highlighted Text'));
console.log(c35('Another Gradient Effect'));