Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansi-256-colors

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-256-colors

256 xterm color codes

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ansi-256-colors Build 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..6], <green>[0..6], <blue>[0..6])

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..7]

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

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

The 8 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

Keywords

FAQs

Package last updated on 10 May 2015

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