Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color)
  2. > Detect whether a terminal supports color
  3. ## Install
  4. ```
  5. $ npm install supports-color
  6. ```
  7. ## Usage
  8. ```js
  9. const supportsColor = require('supports-color');
  10. if (supportsColor.stdout) {
  11. console.log('Terminal stdout supports color');
  12. }
  13. if (supportsColor.stdout.has256) {
  14. console.log('Terminal stdout supports 256 colors');
  15. }
  16. if (supportsColor.stderr.has16m) {
  17. console.log('Terminal stderr supports 16 million colors (truecolor)');
  18. }
  19. ```
  20. ## API
  21. Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
  22. The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:
  23. - `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
  24. - `.level = 2` and `.has256 = true`: 256 color support
  25. - `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)
  26. ## Info
  27. It obeys the `--color` and `--no-color` CLI flags.
  28. Can 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.
  29. Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
  30. ## Related
  31. - [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
  32. - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
  33. ## Maintainers
  34. - [Sindre Sorhus](https://github.com/sindresorhus)
  35. - [Josh Junon](https://github.com/qix-)
  36. ## License
  37. MIT