@oclif/core 4.0.0-beta.16 → 4.0.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function supportsColor(): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.supportsColor = void 0;
|
|
4
|
+
const supports_color_1 = require("supports-color");
|
|
5
|
+
function supportsColor() {
|
|
6
|
+
return Boolean(supports_color_1.stdout) && Boolean(supports_color_1.stderr);
|
|
7
|
+
}
|
|
8
|
+
exports.supportsColor = supportsColor;
|
package/lib/ux/theme.js
CHANGED
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.parseTheme = exports.colorize = void 0;
|
|
7
7
|
const ansis_1 = __importDefault(require("ansis"));
|
|
8
|
-
const supports_color_1 = require("supports-color");
|
|
9
8
|
const theme_1 = require("../interfaces/theme");
|
|
9
|
+
const supports_color_1 = require("./supports-color");
|
|
10
10
|
function isStandardAnsi(color) {
|
|
11
11
|
return theme_1.STANDARD_ANSI.includes(color);
|
|
12
12
|
}
|
|
@@ -19,9 +19,7 @@ function isStandardAnsi(color) {
|
|
|
19
19
|
function colorize(color, text) {
|
|
20
20
|
if (!color)
|
|
21
21
|
return text;
|
|
22
|
-
if (!supports_color_1.
|
|
23
|
-
return text;
|
|
24
|
-
if (!supports_color_1.stderr)
|
|
22
|
+
if (!(0, supports_color_1.supportsColor)())
|
|
25
23
|
return text;
|
|
26
24
|
if (isStandardAnsi(color))
|
|
27
25
|
return ansis_1.default[color](text);
|