spray-print

Colorized print

spray-print is a library that makes your console prints more vibrant using chalk.

Installation

npm install spray-print

Once you've added spray print to your project, you have to require it in your file.

const print = require('spray-print');

Usage

There are several types of printouts, and a custom one too:

print.println('Message');
print.warn('Warning');
print.error('Error');
print.success(':D');
print.custom('title','message');

There is also an alternate styling choice that uses (!) instead of [!]:

print.cprint('Message');
print.cwarn('Warning');
print.cerror('Error');
print.csuccess(':D');

Anything that works with console.log works here, so you can still display variables and join strings.

Standard Print

print.println('Message');
print.cprint('Message'); // Alternate Style

A standard print is signified by a blue ! character inside brackets.

Warning Print

print.warn('Warning');
print.cwarn('Warning'); // Alternate Style

A standard print is signified by a yellow ! character inside brackets.

Error Print

print.error('Error');
print.cerror('Error'); // Alternate Style

A standard print is signified by a red ! character inside brackets. It's advised you use this over console.error in nodejs commandline apps, as it stands out more.

Success Print

print.success('Success');
print.csuccess('Success'); // Alternate Style

A standard print is signified by a green ! character inside brackets. Should be used to show that a task completed successfully.

Custom Print

print.custom('Title','Text');

A standard print is signified by blue text inside brackets. This text is derived from the first given argument, while the second is the content.

Last updated

Was this helpful?