UNPKG

@visulima/is-ansi-color-supported

Version:

Detect whether a terminal or browser supports ansi colors.

24 lines (21 loc) 974 B
import { SPACE_TRUE_COLORS, SPACE_16_COLORS, SPACE_MONO } from './packem_shared/SPACE_MONO-VdlYcTli.mjs'; export { SPACE_256_COLORS } from './packem_shared/SPACE_MONO-VdlYcTli.mjs'; var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); const isColorSupported = /* @__PURE__ */ __name(() => (() => { if (typeof navigator !== "undefined") { if (navigator.userAgentData) { const brand = navigator.userAgentData.brands.find(({ b }) => b === "Chromium"); if (brand?.version > 93) { return SPACE_TRUE_COLORS; } } if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) { return SPACE_16_COLORS; } } return SPACE_MONO; })(), "isColorSupported"); const isStdoutColorSupported = isColorSupported; const isStderrColorSupported = isColorSupported; export { SPACE_16_COLORS, SPACE_MONO, SPACE_TRUE_COLORS, isStderrColorSupported, isStdoutColorSupported };