How to use the ansicolors.bgBlack 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 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) {
            return makeArchy_(sortedObject(data.dependencies[d]), long, dir, depth + 1, data, d)
          })
      }
    } else {
      return {label: d + '@' + data.requiredBy}
    }
github graalvm / graaljs / deps / npm / lib / ls.js View on Github external
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
  }

  // add giturl to name@version
  if (data._resolved) {
    try {
      var type = npa(data._resolved).type
      var isGit = type === 'git' || type === 'hosted'
github liquidg3 / altair / node_modules / npm / lib / ls.js View on Github external
} 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) {
    var extraneous = 'extraneous'
    if (npm.color) extraneous = color.bgBlack(color.green(extraneous))
    out.label += ' ' + extraneous
  }

  if (data.error && depth) {
github snyk / resolve-deps / cli / print.js View on Github external
printed = tree(res, function (leaf) {
    var label = leaf.full;

    if (leaf.extraneous) {
      label += ' ' + ext;
    }

    if (leaf.bundled) {
      label += ' ' + bundled;
    }

    if (leaf.shrinkwrap) {
      label += ' ' + colour.bgBlack(colour.yellow('shrinkwrap via ' +
        leaf.shrinkwrap));
    }

    return label;
  });