Skip to content

Commit eb1f5cc

Browse files
johanblumenbergsindresorhus
authored andcommitted
Set color option to what is supported by the current env (#190)
1 parent c5da1d1 commit eb1f5cc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const dargs = require('dargs');
33
const execa = require('execa');
44
const PluginError = require('plugin-error');
5+
const supportsColor = require('supports-color');
56
const through = require('through2');
67
// TODO: Use execa localDir option when available
78
const npmRunPath = require('npm-run-path');
@@ -16,7 +17,7 @@ const MULTIPLE_OPTS = new Set([
1617

1718
module.exports = opts => {
1819
opts = Object.assign({
19-
colors: true,
20+
colors: Boolean(supportsColor.stdout),
2021
suppress: false
2122
}, opts);
2223

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"mocha": "^5.2.0",
4040
"npm-run-path": "^2.0.2",
4141
"plugin-error": "^0.1.2",
42+
"supports-color": "^5.4.0",
4243
"through2": "^2.0.3"
4344
},
4445
"devDependencies": {

0 commit comments

Comments
 (0)