Mini NPM package with coloured log functions and more.
Please refer to the contribution guideline.
Maximilian Berkmann 🐛 💻 📖 🤔 💬 👀 🛡️ |
Dependabot 🔧 |
Semantic Release Bot 📖 📦 |
Codacy Badger 📖 |
---|
Set of functions for coloured logs.
data
...any
- See: log
Print an error.
data
...any Data to print
error('Something wrong happened with', new Error(this));
Returns boolean Did it happened?
- See: log
Print an information.
data
...any Data to print
info('Welcome John');
Returns boolean Did it happened?
- See: log
Print a debug message.
data
...any Data to print
dbg('i=', i);
Returns boolean Did it happened?
- See: log
Print an output.
data
...any Data to print
out(`1 + 1 = ${rpc('1 1 +')}`);
Returns boolean Did it happened?
- See: log
Print an input.
data
...any Data to print
inp(name);
Returns boolean Did it happened?
- See: log
Print a warning.
data
...any Data to print
warn('The following function is deprecated');
Returns boolean Did it happened?
- See: log
Print a question.
data
...any Data to print
quest('What is your username?');
Returns boolean Did it happened?
- See: log
Print a success log.
data
...any Data to print
succ('Achievement unlocked');
Returns boolean Did it happened?
Extend the current theme.
Using extensions as methods:
const nclr = require('nclr');
nclr.extend({
suc: ['green', 'underline'],
data: 'magenta'
});
nclr.suc('Yay!');
nclr.data(42);
Using extensions as functions:
const nclr = require('nclr');
nclr.extend({
suc: ['green', 'underline'],
data: 'magenta'
});
const { suc, data } = nclr;
suc('Yay!');
data(42);
- Throws Error Invalid extension key
CLI colours.
Colour/style theme for the CLI.
Type: {inp: string, out: Array<string>, info: string, error: string, warn: string, dbg: string, quest: string}
Set of library functions for nclr.
STDOUT log.
data
any Data to print
log('Lorem ipsum dolore sit amet');
Returns boolean Did it happened?
Colourise something.
name
string Name of the log in the themedata
...any Data
let information = use('info', 'Some info styled text');
Nesting
log('Something', use('warn', 'really ', use('info', 'cool!')));
- Throws Error Invalid name
Returns string Coloured output
Restore the default fields of the theme.