Socket
Socket
Sign inDemoInstall

console-colors-2

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    console-colors-2

Colors for Node.JS console logging


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Console Colors 2


Getting Started

Install: npm i console-colors-2


List

Special ( .sp/.special)
whatusage
bold.sp.bold
underline.sp.underline
reset.sp.reset

Foreground & Background (.fg/.foreground & .bg/.background)
whatforeground usage (.fg/.foreground)background usage (.bg/.background)
black.fg.black.bg.black
red.fg.red.bg.red
green.fg.green.bg.green
yellow.fg.yellow.bg.yellow
blue.fg.blue.bg.blue
magenta.fg.magenta.bg.magenta
cyan.fg.cyan.bg.cyan
white.fg.white.bg.white

Usage:

Foreground Color:
const colors = require("console-colors-2");

//will log "test" to console in red, with a black background
console.log(colors.fg.red+"test"+colors.sp.reset);

//templated string example
console.log(`${colors.fg.red}test${colors.sp.reset}`);

// make sure to add reset after each, or the rest of the console output
// will be whatever you used

Background Color:
const colors = require("console-colors-2");

//will log "test" to console in white, with a red background
console.log(colors.bg.red+"test"+colors.sp.reset);

//templated string example
console.log(`${colors.bg.red}test${colors.sp.reset}`);

// make sure to add reset after each, or the rest of the console output
// will be whatever you used

FAQs

Last updated on 30 May 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc