UNPKG

cli-color

Version:

Colors, formatting and other tools for the console

24 lines (17 loc) 661 B
"use strict"; // store whether supports-color mode is enabled or not. var state = null; // force supports-color mode var enableColor = function () { state = true; }; // disable supports-color mode var disableColor = function () { state = false; }; // use the NO_COLOR environment variable (default) var autoDetectSupport = function () { state = null; }; // determine whether supports-color mode is enabled. var isColorSupported = function () { return state === null ? !process.env.NO_COLOR : state; }; module.exports = { enableColor: enableColor, disableColor: disableColor, autoDetectSupport: autoDetectSupport, isColorSupported: isColorSupported };