Skip to content

jbnicolai/ansi-256-colors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansi-256-colors

npm version Build Status Coverage Status Dependency Status

256 ansi color codes for styling terminal output

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

screenshot

Install

$ npm install --save ansi-256-colors

Usage

var colors = require('ansi-256-colors');

console.log(colors.fg.getRgb(2,3,4) + colors.bg.getRgb(4,4,4) + 'Hello world!' + colors.reset);

API

The module exposes a fg and bg object, and a reset code. Both the foreground and background objects contain:

colors.<fg|bg>.getRgb(<red>[0..5], <green>[0..5], <blue>[0..5])

Returns the color code for the given red-green-blue value.

colors.<fg|bg>.codes[0..255]

All 256 color codes.

colors.<fg|bg>.standard[0..5]

The 6 base color codes, guaranteed to work on every system.

colors.<fg|bg>.bright[0..5]

The 6 base bright/bold color codes, guaranteed to work on every system.

colors.<fg|bg>.grayscale[0..23]

The 24 grayscales ranging from white to black.

colors.<fg|bg>.rgb[0..216]

The 216 varying color tints, where the order corresponds to the code-point 36*r + 6*g + b.

colors.reset

Closes any previously opened color codes.

License

MIT © Joshua Boy Nicolai Appelman

About

256 ansi color codes for sparkling rainbows in the terminal

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •