# ansi-256-colors

> 256 xterm color codes

Latest version **1.1.0** (published 2015-05-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install ansi-256-colors
pnpm add ansi-256-colors
yarn add ansi-256-colors
bun add ansi-256-colors
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2015-05-10 |
| First published | 2014-08-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 123 |
| Author | Joshua Appelman |
| Maintainers | jbnicolai |
| Keywords | color, colour, colors, terminal, console, cli, string, ansi, styles, tty, formatting, rgb, 256, shell, xterm, log, logging, command-line, text |

## Links

- npm: https://www.npmjs.com/package/ansi-256-colors
- Repository: https://github.com/jbnicolai/ansi-256-colors
- Issues: https://github.com/jbnicolai/ansi-256-colors/issues
- npm.io page: https://npm.io/package/ansi-256-colors

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2015-05-10
- 1.0.3 — 2014-12-28
- 1.0.2 — 2014-08-30
- 1.0.1 — 2014-08-30

## README

# ansi-256-colors [![Build Status](https://travis-ci.org/jbnicolai/ansi-256-colors.svg?branch=master)](https://travis-ci.org/jbnicolai/ansi-256-colors)

> [256 ansi color codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) for styling terminal output

You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings.

![screenshot](https://i.imgur.com/Kilr0mC.png?1)


## Install

```sh
$ npm install --save ansi-256-colors
```

## Usage

```js
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](http://jbnicolai.com)

---
_Source: https://npm.io/package/ansi-256-colors · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
