aboutsummaryrefslogtreecommitdiff
path: root/node_modules/supports-color
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-20 03:09:25 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-24 16:14:29 +0200
commit82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch)
tree965f6eb89b84d65a62b49008fd972c004832ccd1 /node_modules/supports-color
parente6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff)
downloadwallet-core-82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8.tar.xz
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node.
Diffstat (limited to 'node_modules/supports-color')
-rw-r--r--node_modules/supports-color/index.js81
-rw-r--r--node_modules/supports-color/package.json41
-rw-r--r--node_modules/supports-color/readme.md42
3 files changed, 120 insertions, 44 deletions
diff --git a/node_modules/supports-color/index.js b/node_modules/supports-color/index.js
index a2b978450..2571c735f 100644
--- a/node_modules/supports-color/index.js
+++ b/node_modules/supports-color/index.js
@@ -1,39 +1,84 @@
'use strict';
-var argv = process.argv;
+var hasFlag = require('has-flag');
-module.exports = (function () {
- if (argv.indexOf('--no-color') !== -1 ||
- argv.indexOf('--no-colors') !== -1 ||
- argv.indexOf('--color=false') !== -1) {
+var support = function (level) {
+ if (level === 0) {
return false;
}
- if (argv.indexOf('--color') !== -1 ||
- argv.indexOf('--colors') !== -1 ||
- argv.indexOf('--color=true') !== -1 ||
- argv.indexOf('--color=always') !== -1) {
- return true;
+ return {
+ level: level,
+ hasBasic: true,
+ has256: level >= 2,
+ has16m: level >= 3
+ };
+};
+
+var supportLevel = (function () {
+ if (hasFlag('no-color') ||
+ hasFlag('no-colors') ||
+ hasFlag('color=false')) {
+ return 0;
+ }
+
+ if (hasFlag('color=16m') ||
+ hasFlag('color=full') ||
+ hasFlag('color=truecolor')) {
+ return 3;
+ }
+
+ if (hasFlag('color=256')) {
+ return 2;
+ }
+
+ if (hasFlag('color') ||
+ hasFlag('colors') ||
+ hasFlag('color=true') ||
+ hasFlag('color=always')) {
+ return 1;
}
if (process.stdout && !process.stdout.isTTY) {
- return false;
+ return 0;
}
if (process.platform === 'win32') {
- return true;
+ return 1;
}
- if ('COLORTERM' in process.env) {
- return true;
+ if ('CI' in process.env) {
+ if ('TRAVIS' in process.env || process.env.CI === 'Travis') {
+ return 1;
+ }
+
+ return 0;
}
- if (process.env.TERM === 'dumb') {
- return false;
+ if ('TEAMCITY_VERSION' in process.env) {
+ return process.env.TEAMCITY_VERSION.match(/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/) === null ? 0 : 1;
+ }
+
+ if (/^(screen|xterm)-256(?:color)?/.test(process.env.TERM)) {
+ return 2;
}
if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
- return true;
+ return 1;
+ }
+
+ if ('COLORTERM' in process.env) {
+ return 1;
}
- return false;
+ if (process.env.TERM === 'dumb') {
+ return 0;
+ }
+
+ return 0;
})();
+
+if (supportLevel === 0 && 'FORCE_COLOR' in process.env) {
+ supportLevel = 1;
+}
+
+module.exports = process && support(supportLevel);
diff --git a/node_modules/supports-color/package.json b/node_modules/supports-color/package.json
index 7f72e762a..0cc4b383d 100644
--- a/node_modules/supports-color/package.json
+++ b/node_modules/supports-color/package.json
@@ -1,30 +1,32 @@
{
"name": "supports-color",
- "version": "1.2.0",
+ "version": "3.2.3",
"description": "Detect whether a terminal supports color",
"license": "MIT",
- "repository": "sindresorhus/supports-color",
+ "repository": "chalk/supports-color",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
- "url": "http://sindresorhus.com"
- },
- "bin": {
- "supports-color": "cli.js"
+ "url": "sindresorhus.com"
},
+ "maintainers": [
+ "Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
+ "Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)",
+ "JD Ballard <i.am.qix@gmail.com> (github.com/qix-)"
+ ],
+ "browser": "browser.js",
"engines": {
- "node": ">=0.10.0"
+ "node": ">=0.8.0"
},
"scripts": {
- "test": "mocha"
+ "test": "xo && mocha",
+ "travis": "mocha"
},
"files": [
"index.js",
- "cli.js"
+ "browser.js"
],
"keywords": [
- "cli",
- "bin",
"color",
"colour",
"colors",
@@ -42,10 +44,23 @@
"support",
"supports",
"capability",
- "detect"
+ "detect",
+ "truecolor",
+ "16m",
+ "million"
],
+ "dependencies": {
+ "has-flag": "^1.0.0"
+ },
"devDependencies": {
"mocha": "*",
- "require-uncached": "^1.0.2"
+ "require-uncached": "^1.0.2",
+ "xo": "*"
+ },
+ "xo": {
+ "envs": [
+ "node",
+ "mocha"
+ ]
}
}
diff --git a/node_modules/supports-color/readme.md b/node_modules/supports-color/readme.md
index 32d4f46e9..f7bae4c54 100644
--- a/node_modules/supports-color/readme.md
+++ b/node_modules/supports-color/readme.md
@@ -1,11 +1,11 @@
-# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color)
+# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color)
> Detect whether a terminal supports color
## Install
-```sh
+```
$ npm install --save supports-color
```
@@ -18,25 +18,41 @@ var supportsColor = require('supports-color');
if (supportsColor) {
console.log('Terminal supports color');
}
+
+if (supportsColor.has256) {
+ console.log('Terminal supports 256 colors');
+}
+
+if (supportsColor.has16m) {
+ console.log('Terminal supports 16 million colors (truecolor)');
+}
```
-It obeys the `--color` and `--no-color` CLI flags.
+## API
-## CLI
+Returns an `object`, or `false` if color is not supported.
-```sh
-$ npm install --global supports-color
-```
+The returned object specifies a level of support for color through a `.level` property and a corresponding flag:
-```
-$ supports-color --help
+- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
+- `.level = 2` and `.has256 = true`: 256 color support
+- `.level = 3` and `.has16m = true`: 16 million (truecolor) support
- Usage
- supports-color
- Exits with code 0 if color is supported and 1 if not
-```
+## Info
+
+It obeys the `--color` and `--no-color` CLI flags.
+
+For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`.
+
+Explicit 256/truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
+
+
+## Related
+
+- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
+- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
## License