All files / lib/internal/util colors.js

100% Statements 23/23
100% Branches 13/13
100% Functions 1/1
100% Lines 23/23

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24110x 110x 110x 110x 110x 110x 110x 110x 110x 110x 6016x 42x 42x 42x 42x 42x 42x 42x 42x 6016x 110x 110x 110x  
'use strict';
 
module.exports = {
  blue: '',
  green: '',
  white: '',
  red: '',
  clear: '',
  hasColors: false,
  refresh() {
    if (process.stderr.isTTY) {
      const hasColors = process.stderr.hasColors();
      module.exports.blue = hasColors ? '\u001b[34m' : '';
      module.exports.green = hasColors ? '\u001b[32m' : '';
      module.exports.white = hasColors ? '\u001b[39m' : '';
      module.exports.red = hasColors ? '\u001b[31m' : '';
      module.exports.clear = hasColors ? '\u001bc' : '';
      module.exports.hasColors = hasColors;
    }
  }
};
 
module.exports.refresh();