source: imaps-frontend/node_modules/supports-color/readme.md

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.8 KB
Line 
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 supports-color
10```
11
12
13## Usage
14
15```js
16const supportsColor = require('supports-color');
17
18if (supportsColor.stdout) {
19 console.log('Terminal stdout supports color');
20}
21
22if (supportsColor.stdout.has256) {
23 console.log('Terminal stdout supports 256 colors');
24}
25
26if (supportsColor.stderr.has16m) {
27 console.log('Terminal stderr supports 16 million colors (truecolor)');
28}
29```
30
31
32## API
33
34Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
35
36The `stdout`/`stderr` objects 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`: Truecolor support (16 million colors)
41
42
43## Info
44
45It obeys the `--color` and `--no-color` CLI flags.
46
47Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
48
49Explicit 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## Maintainers
59
60- [Sindre Sorhus](https://github.com/sindresorhus)
61- [Josh Junon](https://github.com/qix-)
62
63
64## License
65
66MIT
Note: See TracBrowser for help on using the repository browser.