UNPKG

1.62 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.color = exports.CustomColors = void 0;
4const ansiStyles = require("ansi-styles");
5const supports = require("supports-color");
6const chalk = require('chalk');
7const dim = process.env.ConEmuANSI === 'ON' ? chalk.gray : chalk.dim;
8exports.CustomColors = {
9 supports,
10 // map gray -> dim because it's not solarized compatible
11 gray: dim,
12 grey: dim,
13 dim,
14 attachment: chalk.cyan,
15 addon: chalk.yellow,
16 configVar: chalk.green,
17 release: chalk.blue.bold,
18 cmd: chalk.cyan.bold,
19 pipeline: chalk.green.bold,
20 app: (s) => chalk.level > 0 ? exports.color.heroku(`⬢ ${s}`) : s,
21 heroku: (s) => {
22 if (chalk.level === 0)
23 return s;
24 if (!exports.color.supports)
25 return s;
26 let has256 = exports.color.supportsColor.has256 || (process.env.TERM || '').indexOf('256') !== -1;
27 return has256 ? '\u001b[38;5;104m' + s + ansiStyles.reset.open : chalk.magenta(s);
28 },
29};
30exports.color = new Proxy(chalk, {
31 get: (chalk, name) => {
32 if (exports.CustomColors[name])
33 return exports.CustomColors[name];
34 return chalk[name];
35 },
36 set: (chalk, name, value) => {
37 switch (name) {
38 case 'enabled':
39 if (value)
40 chalk.level = 2;
41 else
42 chalk.level = 0;
43 break;
44 default:
45 throw new Error(`cannot set property ${name.toString()}`);
46 }
47 return true;
48 },
49});
50exports.default = exports.color;