Initial commit
[yaffs-website] / node_modules / postcss / node_modules / supports-color / readme.md
1 # supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color)
2
3 > Detect whether a terminal supports color
4
5
6 ## Install
7
8 ```
9 $ npm install --save supports-color
10 ```
11
12
13 ## Usage
14
15 ```js
16 var supportsColor = require('supports-color');
17
18 if (supportsColor) {
19         console.log('Terminal supports color');
20 }
21
22 if (supportsColor.has256) {
23         console.log('Terminal supports 256 colors');
24 }
25
26 if (supportsColor.has16m) {
27         console.log('Terminal supports 16 million colors (truecolor)');
28 }
29 ```
30
31
32 ## API
33
34 Returns an `object`, or `false` if color is not supported.
35
36 The returned object specifies a level of support for color through a `.level` property and a corresponding flag:
37
38 - `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
39 - `.level = 2` and `.has256 = true`: 256 color support
40 - `.level = 3` and `.has16m = true`: 16 million (truecolor) support
41
42
43 ## Info
44
45 It obeys the `--color` and `--no-color` CLI flags.
46
47 For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`.
48
49 Explicit 256/truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
50
51
52 ## Related
53
54 - [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
55 - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
56
57
58 ## License
59
60 MIT © [Sindre Sorhus](http://sindresorhus.com)