diff --git a/lib/internal/util/colors.js b/lib/internal/util/colors.js index 812048c923bee7..0b37694b513fb0 100644 --- a/lib/internal/util/colors.js +++ b/lib/internal/util/colors.js @@ -24,16 +24,27 @@ module.exports = { stream.getColorDepth() > 2 : true); }, refresh() { - const hasColors = module.exports.shouldColorize(process.stderr); - module.exports.blue = hasColors ? '\u001b[34m' : ''; - module.exports.green = hasColors ? '\u001b[32m' : ''; - module.exports.white = hasColors ? '\u001b[39m' : ''; - module.exports.yellow = hasColors ? '\u001b[33m' : ''; - module.exports.red = hasColors ? '\u001b[31m' : ''; - module.exports.gray = hasColors ? '\u001b[90m' : ''; - module.exports.clear = hasColors ? '\u001bc' : ''; - module.exports.reset = hasColors ? '\u001b[0m' : ''; - module.exports.hasColors = hasColors; + if (module.exports.shouldColorize(process.stderr)) { + module.exports.blue = '\u001b[34m'; + module.exports.green = '\u001b[32m'; + module.exports.white = '\u001b[39m'; + module.exports.yellow = '\u001b[33m'; + module.exports.red = '\u001b[31m'; + module.exports.gray = '\u001b[90m'; + module.exports.clear = '\u001bc'; + module.exports.reset = '\u001b[0m'; + module.exports.hasColors = true; + } else { + module.exports.blue = ''; + module.exports.green = ''; + module.exports.white = ''; + module.exports.yellow = ''; + module.exports.red = ''; + module.exports.gray = ''; + module.exports.clear = ''; + module.exports.reset = ''; + module.exports.hasColors = false; + } }, };