Nerdiest Political Manifesto
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

nclr

2.2.5 • Public • Published

nclr

NPM

GitHub package version devDependencies Status dependencies Status

GH Downloads GitHub commit activity the past year GitHub contributors Github search hit counter

Build Status codecov.io Code Coverage tested with jest Known Vulnerabilities

GitHub contributions welcome Commitizen friendly

GitHub top language GitHub language count GitHub code size in bytes

BCH compliance Codacy Badge

Mini NPM package with coloured log functions and more.

Contributions

Please refer to the contribution guideline.

Contributors


Maximilian Berkmann

🐛 💻 📖 🤔 💬 👀 🛡️ ⚠️

Dependabot

🔧

Semantic Release Bot

📖 📦

Codacy Badger

📖

Documentation

Table of Contents

index

Set of functions for coloured logs.

Parameters

  • data ...any

error

  • See: log

Print an error.

Parameters

  • data ...any Data to print

Examples

error('Something wrong happened with', new Error(this));

Returns boolean Did it happened?

info

  • See: log

Print an information.

Parameters

  • data ...any Data to print

Examples

info('Welcome John');

Returns boolean Did it happened?

dbg

  • See: log

Print a debug message.

Parameters

  • data ...any Data to print

Examples

dbg('i=', i);

Returns boolean Did it happened?

out

  • See: log

Print an output.

Parameters

  • data ...any Data to print

Examples

out(`1 + 1 = ${rpc('1 1 +')}`);

Returns boolean Did it happened?

inp

  • See: log

Print an input.

Parameters

  • data ...any Data to print

Examples

inp(name);

Returns boolean Did it happened?

warn

  • See: log

Print a warning.

Parameters

  • data ...any Data to print

Examples

warn('The following function is deprecated');

Returns boolean Did it happened?

quest

  • See: log

Print a question.

Parameters

  • data ...any Data to print

Examples

quest('What is your username?');

Returns boolean Did it happened?

succ

  • See: log

Print a success log.

Parameters

  • data ...any Data to print

Examples

succ('Achievement unlocked');

Returns boolean Did it happened?

extend

Extend the current theme.

Parameters

Examples

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

clr

CLI colours.

clr

Colour/style theme for the CLI.

Type: {inp: string, out: Array<string>, info: string, error: string, warn: string, dbg: string, quest: string}

lib

Set of library functions for nclr.

log

STDOUT log.

Parameters

  • data any Data to print

Examples

log('Lorem ipsum dolore sit amet');

Returns boolean Did it happened?

use

Colourise something.

Parameters

  • name string Name of the log in the theme
  • data ...any Data

Examples

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

restoreTheme

Restore the default fields of the theme.

Install

npm i nclr

DownloadsWeekly Downloads

50

Version

2.2.5

License

MIT

Unpacked Size

122 kB

Total Files

33

Last publish

Collaborators

  • avatar