1.0.4 • Published 2 years ago

@comodinx/colors v1.0.4

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
2 years ago

@comodinx/colors

This is a simple proof of concept. An exercise.

We were inspired by and strongly recommend using colors

Installation

npm i @comodinx/colors

colors and styles!

text and bright text colors

colorbright
black
redbrightRed
greenbrightGreen
yellowbrightYellow
bluebrightBlue
magentabrightMagenta
cyanbrightCyan
whitebrightWhite
grey

background and bright background colors

colorbright
bgBlack
bgRedbgBrightRed
bgGreenbgBrightGreen
bgYellowbgBrightYellow
bgBluebgBrightBlue
bgMagentabgBrightMagenta
bgCyanbgBrightCyan
bgWhitebgBrightWhite
bgGrey

styles

style
reset
bold
dim
italic
underline
inverse
hidden
strikethrough

Usage

The super nifty way

require('@comodinx/colors');

console.log('hello'.green);
console.log('i like cake and pies'.underline.red);
console.log('inverse the color'.inverse);

or a slightly less nifty way which doesn't extend String.prototype

const colors = require('@comodinx/colors/safe');

console.log(colors.green('hello'));
console.log(colors.red(colors.underline('i like cake and pies')));
console.log(colors.inverse('inverse the color'));

Prevent extend String.prototype

COLORS_ON_STRING_PROTO=0 node myapp.js

Console.log string substitution

const name = 'Marak';
console.log(colors.green('Hello %s'), name);
// outputs -> 'Hello Marak'

Alias

const colors = require('@comodinx/colors');

colors.setAlias({
    title: 'bold',
    success: 'green',
    error: 'red',
    warn: 'yellow',
    info: 'cyan'
});

console.log('🟢  Congratulations'.success);
console.log('🔴  ERROR'.error);
console.log('🟡  ¡¡¡WARNING!!!'.warn);
console.log('🔵  This is an information message'.info);
console.log('This is a title for success message'.title.success);
1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago