raptor-colors
v1.2.0
Published
A TypeScript library for IRC-style text coloring
Maintainers
Readme
Raptor Colors 🌈
A TypeScript library for adding IRC-style colors to text strings.
Installation
npm install raptor-colors
# or
yarn add raptor-colorsUsage
import rc from 'raptor-colors';
// Basic usage
console.log(rc.red('This text is red'));
console.log(rc.blue('This text is blue'));
console.log(rc.green('This text is green'));
// With custom background color
console.log(rc.withBackground('white').red('Red text on white background'));Available Colors
- white
- black
- blue
- green
- red
- brown
- purple
- orange
- yellow
- lightGreen
- cyan
- lightCyan
- lightBlue
- pink
- grey
- lightGrey
Methods
Basic Color Methods
All 16 colors listed above are available as direct methods:
rc.red('This text is red')
rc.blue('This text is blue')
// ... all colors follow the same patternCustom Background Colors
Use withBackground to combine a foreground and background color:
rc.withBackground('black').yellow('Yellow text on black background')The bgColor parameter accepts any value from the Available Colors list (ColorName type).
License
MIT
