simple-log-colors
v1.1.0
Published
Extremely lightweight zero-dependency library for coloring Node terminal output
Downloads
935
Readme
simple-log-colors
Extremely lightweight zero-dependency library for coloring Node terminal output
Install
npm install simple-log-colors
Usage
// Modules
import colors from 'simple-log-colors';
// CommonJS
const colors = require('simple-log-colors');
Template strings
console.log(`Hello, ${colors.blue('world')}!`);
console.log(`Everything looks ${colors.cyan('better')} with a little ${colors.magenta('color')}!`);
Concatenation
console.log(colors.redBackground('WARNING') + ' things are getting pretty ' + colors.yellow('colorful') + ' around here.');
Functions
const { red, green, blue } = require('simple-log-colors');
console.log(`${red('Error')} the ${green('POST')} request to the ${blue('/test')} route was not signed properly.`);
Colors
The following colors are supported:
black
red
green
yellow
blue
magenta
cyan
white
All of these colors are also supported as background colors. For background colors, add the suffix Background
onto a supported color.
console.error(colors.redBackground('ERROR'));
License
MIT © Jesse Youngblood