ansi-styles

ANSI escape codes for colorizing strings in the terminal

npm install ansi-styles
21 917 downloads in the last day
171 292 downloads in the last week
757 795 downloads in the last month

ansi-styles Build Status

ANSI escape codes for colorizing strings in the terminal.

You probably want the higher-level chalk module for styling your strings.

screenshot

Install

Install with npm: npm install --save ansi-styles

Example

var ansi = require('ansi-styles');

console.log(ansi.green.open + 'Hello world!' + ansi.green.close);

API

Each style has an open and close property.

Styles

General

  • reset
  • bold
  • italic
  • underline
  • inverse
  • strikethrough

Text colors

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

Background colors

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

License

MIT © Sindre Sorhus

npm loves you