How to use the ansicolors.red function in ansicolors

To help you get started, we’ve selected a few ansicolors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davidhealey / waistline / node_modules / npm / lib / ls.js View on Github external
function makeArchy_ (data, long, dir, depth, parent, d) {
  if (typeof data === "string") {
    if (depth -1 <= npm.config.get("depth")) {
      // just missing
      var unmet = "UNMET DEPENDENCY"
      if (npm.color) {
        unmet = color.bgBlack(color.red(unmet))
      }
      data = unmet + " " + d + "@" + data
    } else {
      data = d+"@"+ data
    }
    return data
  }

  var out = {}
  // the top level is a bit special.
  out.label = data._id || ""
  if (data._found === true && data._id) {
    if (npm.color) {
      out.label = color.bgBlack(color.yellow(out.label.trim())) + " "
    } else {
      out.label = out.label.trim() + " "
github graalvm / graaljs / deps / npm / lib / ls.js View on Github external
function makeArchy_ (data, long, dir, depth, parent, d) {
  if (data.missing) {
    if (depth - 1 <= npm.config.get('depth')) {
      // just missing
      var unmet = 'UNMET ' + (data.optional ? 'OPTIONAL ' : '') + 'DEPENDENCY'
      if (npm.color) {
        if (data.optional) {
          unmet = color.bgBlack(color.yellow(unmet))
        } else {
          unmet = color.bgBlack(color.red(unmet))
        }
      }
      var label = data._id || (d + '@' + data.requiredBy)
      if (data._found === 'explicit' && data._id) {
        if (npm.color) {
          label = color.bgBlack(color.yellow(label.trim())) + ' '
        } else {
          label = label.trim() + ' '
        }
      }
      return {
        label: unmet + ' ' + label,
        nodes: Object.keys(data.dependencies || {})
          .sort(alphasort).filter(function (d) {
            return !isCruft(data.dependencies[d])
          }).map(function (d) {
github liquidg3 / altair / node_modules / npm / lib / ls.js View on Github external
function makeArchy_ (data, long, dir, depth, parent, d) {
  if (data.missing) {
    if (depth - 1 <= npm.config.get('depth')) {
      // just missing
      var unmet = 'UNMET ' + (data.optional ? 'OPTIONAL ' : '') + 'DEPENDENCY'
      if (npm.color) {
        if (data.optional) {
          unmet = color.bgBlack(color.yellow(unmet))
        } else {
          unmet = color.bgBlack(color.red(unmet))
        }
      }
      data = unmet + ' ' + d + '@' + data.requiredBy
    } else {
      data = d + '@' + data.requiredBy
    }
    return data
  }

  var out = {}
  // the top level is a bit special.
  out.label = data._id || ''
  if (data._found === true && data._id) {
    if (npm.color) {
      out.label = color.bgBlack(color.yellow(out.label.trim())) + ' '
    } else {
github liquidg3 / altair / node_modules / npm / lib / ls.js View on Github external
var out = {}
  // the top level is a bit special.
  out.label = data._id || ''
  if (data._found === true && data._id) {
    if (npm.color) {
      out.label = color.bgBlack(color.yellow(out.label.trim())) + ' '
    } else {
      out.label = out.label.trim() + ' '
    }
  }
  if (data.link) out.label += ' -> ' + data.link

  if (data.invalid) {
    if (data.realName !== data.name) out.label += ' (' + data.realName + ')'
    var invalid = 'invalid'
    if (npm.color) invalid = color.bgBlack(color.red(invalid))
    out.label += ' ' + invalid
  }

  if (data.peerInvalid) {
    var peerInvalid = 'peer invalid'
    if (npm.color) peerInvalid = color.bgBlack(color.red(peerInvalid))
    out.label += ' ' + peerInvalid
  }

  if (data.peerMissing) {
    var peerMissing = 'UNMET PEER DEPENDENCY'
    if (npm.color) peerMissing = color.bgBlack(color.red(peerMissing))
    out.label = peerMissing + ' ' + out.label
  }

  if (data.extraneous && data.path !== dir) {
github elastic / kibana / src / server / lib / logging / good_reporters / console.js View on Github external
var typeCrayon = ansicolors[colors[data.level]];
  var output;
  if (this._json) {
    data.message = stripColors(data.message);
    output = stringify(data);
  } else {
    output = nameCrayon(name.substr(0, 3));
    output += ': ';
    output += typeCrayon(data.level.toUpperCase());
    output += ' ';
    output += '[ ';
    output += ansicolors.brightBlack(moment(data.timestamp).format());
    output += ' ] ';

    if (data.error) {
      output += ansicolors.red(data.error.stack);
    } else {
      output += data.message;
    }

  }
  console.log(output);
};
github liquidg3 / altair / node_modules / npm / lib / ls.js View on Github external
if (data.invalid) {
    if (data.realName !== data.name) out.label += ' (' + data.realName + ')'
    var invalid = 'invalid'
    if (npm.color) invalid = color.bgBlack(color.red(invalid))
    out.label += ' ' + invalid
  }

  if (data.peerInvalid) {
    var peerInvalid = 'peer invalid'
    if (npm.color) peerInvalid = color.bgBlack(color.red(peerInvalid))
    out.label += ' ' + peerInvalid
  }

  if (data.peerMissing) {
    var peerMissing = 'UNMET PEER DEPENDENCY'
    if (npm.color) peerMissing = color.bgBlack(color.red(peerMissing))
    out.label = peerMissing + ' ' + out.label
  }

  if (data.extraneous && data.path !== dir) {
    var extraneous = 'extraneous'
    if (npm.color) extraneous = color.bgBlack(color.green(extraneous))
    out.label += ' ' + extraneous
  }

  if (data.error && depth) {
    var message = data.error.message
    if (message.indexOf('\n')) message = message.slice(0, message.indexOf('\n'))
    var error = 'error: ' + message
    if (npm.color) error = color.bgRed(color.brightWhite(error))
    out.label += ' ' + error
  }
github elastic / kibana / tasks / loadFixtures.js View on Github external
}, function bulkResponse(err, res, payload) {
        var status;
        if (err || res.statusCode !== 200) {
          grunt.fail.warn(err || payload);
          status = colors.red('error');
        } else {
          status = colors.green('success');
        }
        grunt.log.writeln(`[${status}] ${file}`);
        if (++doneProcessing === files.length) done();
      });
    });
github elastic / kibana / src / server / logging / LogFormat.js View on Github external
let levelColor = function (code) {
  if (code < 299) return ansicolors.green(code);
  if (code < 399) return ansicolors.yellow(code);
  if (code < 499) return ansicolors.magenta(code);
  return ansicolors.red(code);
};
github graalvm / graaljs / deps / npm / bin / npm-cli.js View on Github external
const isCI = require('ci-info').isCI
      if (
        notifier.update &&
        notifier.update.latest !== pkg.version &&
        !isCI
      ) {
        const color = require('ansicolors')
        const useColor = npm.config.get('color')
        const useUnicode = npm.config.get('unicode')
        const old = notifier.update.current
        const latest = notifier.update.latest
        let type = notifier.update.type
        if (useColor) {
          switch (type) {
            case 'major':
              type = color.red(type)
              break
            case 'minor':
              type = color.yellow(type)
              break
            case 'patch':
              type = color.green(type)
              break
          }
        }
        const changelog = `https://github.com/npm/cli/releases/tag/v${latest}`
        notifier.notify({
          message: `New ${type} version of ${pkg.name} available! ${
            useColor ? color.red(old) : old
          } ${useUnicode ? '→' : '->'} ${
            useColor ? color.green(latest) : latest
          }\n` +