New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

my-colors

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

my-colors

Colorize terminal text for Node

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

License: MIT Build Status

my-colors

Colorize terminal text for Node

createColor(foreground, background, modifier)

Returns a colorizer function.

Both foreground & background arguments expect a color. A color could be one of the following:

  • A supported color name (see list below)
  • 0-255 Number - see 256 color palette
  • HEX - a hex color string that starts with a hash sign (e.g. '#1d3ddf')
  • RGB - an array of three values (e.g. [200, 40, 40])

Example:

// my-app.js
const createColor = require('my-colors');

const warning = createColor('yellow', 'red', 'bold');
const msg = warning('Attention: Do not do that.');

console.log(msg)

Terminal Example

Supported Safe Color Names

  • Black
  • Red
  • Green
  • Yellow
  • Blue
  • Magenta
  • Cyan
  • White

Modifiers

Note: Support may vary between different OS/terminals

  • bold
  • dim
  • italic
  • underline
  • invert
  • strike

Example:

// using hex color foreground, RGB background, and bold & underline modifiers
createColor('#000000', [77, 160, 255], ['bold', 'underline']);

Keywords

FAQs

Package last updated on 23 Apr 2020

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