simple-log-colors
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

simple-log-colors

Extremely lightweight zero-dependency library for coloring Node terminal output

build npm license

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

Readme

Keywords

Package Sidebar

Install

npm i simple-log-colors

Weekly Downloads

140

Version

1.1.0

License

MIT

Unpacked Size

5.61 kB

Total Files

5

Last publish

Collaborators

  • jessety