Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80681 views
1
'use strict';
2
var argv = process.argv;
3
4
module.exports = (function () {
5
if ('FORCE_COLOR' in process.env) {
6
return true;
7
}
8
9
if (argv.indexOf('--no-color') !== -1 ||
10
argv.indexOf('--no-colors') !== -1 ||
11
argv.indexOf('--color=false') !== -1) {
12
return false;
13
}
14
15
if (argv.indexOf('--color') !== -1 ||
16
argv.indexOf('--colors') !== -1 ||
17
argv.indexOf('--color=true') !== -1 ||
18
argv.indexOf('--color=always') !== -1) {
19
return true;
20
}
21
22
if (process.stdout && !process.stdout.isTTY) {
23
return false;
24
}
25
26
if (process.platform === 'win32') {
27
return true;
28
}
29
30
if ('COLORTERM' in process.env) {
31
return true;
32
}
33
34
if (process.env.TERM === 'dumb') {
35
return false;
36
}
37
38
if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
39
return true;
40
}
41
42
return false;
43
})();
44
45