color-tag

1.0.2 • Public • Published

color-tag

A module for distinctly coloring logging text

Example usage

const color = require('color-tag')

console.log(`
  ${color('what would you like for dinner?', '@mix')}
  ${color('pasta!', '@ziva')}
  ${color('spaghetti!', '@mix')}
`)
// =>
//  what would you like for dinner?     // colored green
//  pasta!                              // colored blue
//  spaghetti!                          // colored green

A random color is chosen based on a provided id.

API

color(str, id) => coloredStr

  • str String - a piece of text you'd like colorized
  • id String|Number
    • a unique identifer that will be used to map other related text to the same color
    • if id is ommitted, then id = str

An example ommitting id:

console.log(`
  ${color('@mix')}  | what would you like for dinner?
  ${color('@ziva')} | pasta!
  ${color('@mix')}  | spaghetti!
`)

Readme

Keywords

none

Package Sidebar

Install

npm i color-tag

Weekly Downloads

18

Version

1.0.2

License

ISC

Unpacked Size

2.83 kB

Total Files

4

Last publish

Collaborators

  • mixmix