Socket
Socket
Sign inDemoInstall

cli-color

Package Overview
Dependencies
1
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cli-color

Colors and formatting for the console


Version published
Weekly downloads
2.8M
decreased by-16.37%
Maintainers
0
Created
Weekly downloads
 

Package description

What is cli-color?

The cli-color npm package is a library for adding color and formatting to text in Node.js command line applications. It provides a simple API to style strings that appear in the terminal, making it easier to produce visually distinct and organized output.

What are cli-color's main functionalities?

Text coloring

This feature allows you to change the color of the text output in the terminal. The example shows how to make text appear in red.

const clc = require('cli-color');
console.log(clc.red('This text is red'));

Text formatting

This feature enables text formatting such as making text bold, underlined, etc. The example demonstrates how to make text bold.

const clc = require('cli-color');
console.log(clc.bold('This text is bold'));

Background coloring

This feature allows you to set the background color of the text. The example shows white text on a blue background.

const clc = require('cli-color');
console.log(clc.bgBlue.white('White text on blue background'));

Other packages similar to cli-color

Readme

Source

cli-color - Yet another console color package.

Colors and formatting for the console. This package won't mess with built-ins and provides neat way to predefine color patterns, see below.

Installation

$ npm install cli-color

Usage

Usage:

var clc = require('cli-color');

Output colored text:

console.log(clc.red('Text in red'));

Styles can be mixed:

console.log(clc.red.bgWhite.underline('Underlined red text on white background.'));

Styled text can be mixed with unstyled:

console.log(clc.red('red') + ' plain ' + clc.blue('blue'));

Best way is to predefine needed stylings and then use it:

var error = clc.red.bold;
var warn = clc.yellow;
var notice = clc.blue;

console.log(error('Error!'));
console.log(warn('Warning'));
console.log(notice('Notice'));

Supported are all ANSI colors and styles:

Styles

Styles will display correctly if font used in your console supports them.

  • bold
  • italic
  • underline
  • inverse
  • strike

Foreground colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white

Background colors

  • bgBlack
  • bgRed
  • bgGreen
  • bgYellow
  • bgBlue
  • bgMagenta
  • bgCyan
  • bgWhite

Keywords

FAQs

Last updated on 12 Jul 2011

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc