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