Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

color-tag

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color-tag

A module for distinctly coloring logging text

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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!
`)

FAQs

Package last updated on 04 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc