UNPKG

downtimer

Version:
38 lines 1.39 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = colors; const picocolors_1 = __importDefault(require("picocolors")); /** Identity function: applies no color to string */ const identity = s => s; function colors(useColor) { const noColor = !!process.env.NO_COLOR && useColor && (!picocolors_1.default.isColorSupported); function handleColor(c) { return noColor ? identity : c; } /** Color for function names in log output */ const func = handleColor(picocolors_1.default.cyan); /** Color for type names in log output */ const type = handleColor(picocolors_1.default.red); /** * Color for output that is less relevant to readers (eg parts of stack trace within `node_modules`) */ const quiet = handleColor(picocolors_1.default.gray); /** Color for file names */ const file = handleColor(picocolors_1.default.reset); /** Color for heading text */ const heading = handleColor(picocolors_1.default.magenta); /** Color for error text */ const error = handleColor(picocolors_1.default.red); return { func, type, file, quiet, heading, error, }; } //# sourceMappingURL=colors.js.map