1# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
2
3> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
4
5You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
6
7![](screenshot.png)
8
9
10## Install
11
12```
13$ npm install --save ansi-styles
14```
15
16
17## Usage
18
19```js
20var ansi = require('ansi-styles');
21
22console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
23```
24
25
26## API
27
28Each style has an `open` and `close` property.
29
30
31## Styles
32
33### Modifiers
34
35- `reset`
36- `bold`
37- `dim`
38- `italic` *(not widely supported)*
39- `underline`
40- `inverse`
41- `hidden`
42- `strikethrough` *(not widely supported)*
43
44### Colors
45
46- `black`
47- `red`
48- `green`
49- `yellow`
50- `blue`
51- `magenta`
52- `cyan`
53- `white`
54- `gray`
55
56### Background colors
57
58- `bgBlack`
59- `bgRed`
60- `bgGreen`
61- `bgYellow`
62- `bgBlue`
63- `bgMagenta`
64- `bgCyan`
65- `bgWhite`
66
67
68## Advanced usage
69
70By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
71
72- `ansi.modifiers`
73- `ansi.colors`
74- `ansi.bgColors`
75
76
77###### Example
78
79```js
80console.log(ansi.colors.green.open);
81```
82
83
84## License
85
86MIT © [Sindre Sorhus](http://sindresorhus.com)
87