How to use the colors/safe.gray function in colors

To help you get started, we’ve selected a few colors 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 osmlab / name-suggestion-index / build_brands.js View on Github external
// Warn if user put `wikidata`/`wikipedia` instead of `brand:wikidata`/`brand:wikipedia`
    ['wikipedia', 'wikidata'].forEach(osmkey => {
      const val = obj.tags[osmkey];
      if (val) {
        warnFormatTag.push([kvnd, `${osmkey} = ${val}`]);
      }
    });
  });

  if (warnMatched.length) {
    console.warn(colors.yellow('\nWarning - Brands match other brands:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('If the brands are the different, add a disambiguator after the name, like `~(USA)` vs `~(Canada)`'));
    console.warn(colors.gray('If the brands are the same, remove extra `matchTags` or `matchNames`.  Remember:'));
    console.warn(colors.gray('- Name matching ignores letter case, punctuation, spacing, and diacritical marks (é vs e). '));
    console.warn(colors.gray('  No need to add `matchNames` for variations in these.'));
    console.warn(colors.gray('- Tag matching automatically includes other similar tags in the same match group.'));
    console.warn(colors.gray('  No need to add `matchTags` for similar tags.  see `config/match_groups.json`'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnMatched.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> matches? -> ' + colors.yellow('"' + w[1] + '"')
    ));
    console.warn('total ' + warnMatched.length);
  }

  if (warnMissingTag.length) {
    console.warn(colors.yellow('\nWarning - Missing tags for brands:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('To resolve these, add the missing tag.'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnMissingTag.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> missing tag? -> ' + colors.yellow('"' + w[1] + '"')
github osmlab / name-suggestion-index / build_brands.js View on Github external
if (warnFormatTag.length) {
    console.warn(colors.yellow('\nWarning - Unusual OpenStreetMap tag:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('To resolve these, make sure the OpenStreetMap tag is correct.'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnFormatTag.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> unusual tag? -> ' + colors.yellow('"' + w[1] + '"')
    ));
    console.warn('total ' + warnFormatTag.length);
  }

  if (warnDuplicate.length) {
    console.warn(colors.yellow('\nWarning - Potential duplicate brand names:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('To resolve these, remove the worse entry and add `matchNames`/`matchTags` properties on the better entry.'));
    console.warn(colors.gray('To suppress this warning for entries that really are different, add a `nomatch` property on both entries.'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnDuplicate.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> duplicates? -> ' + colors.yellow('"' + w[1] + '"')
    ));
    console.warn('total ' + warnDuplicate.length);
  }

  // if (warnMissingWikidata.length) {
  //   console.warn(colors.yellow('\nWarning - Brand missing `brand:wikidata`:'));
  //   console.warn(colors.gray('--------------------------------------------------------------------------------'));
  //   console.warn(colors.gray('To resolve these, make sure "brand:wikidata" tag looks like "Q191615".'));
  //   console.warn(colors.gray('--------------------------------------------------------------------------------'));
  //   warnMissingWikidata.forEach(w => console.warn(
  //     colors.yellow('  "' + w + '"') + ' -> missing -> "brand:wikidata"'
  //   ));
  //   console.warn('total ' + warnMissingWikidata.length);
github aws / jsii / packages / jsii / lib / assembler.ts View on Github external
private async _visitEnum(type: ts.Type, ctx: EmitContext): Promise {
    if (LOG.isTraceEnabled()) {
      LOG.trace(`Processing enum: ${colors.gray(ctx.namespace.join('.'))}.${colors.cyan(type.symbol.name)}`);
    }

    // Forcefully resolving to the EnumDeclaration symbol for single-valued enums
    const symbol: ts.Symbol = type.isLiteral() ? (type.symbol as any).parent : type.symbol;
    if (!symbol) {
      throw new Error(`Unable to resolve enum declaration for ${type.symbol.name}!`);
    }

    if (_hasInternalJsDocTag(symbol)) {
      return Promise.resolve(undefined);
    }

    this._warnAboutReservedWords(type.symbol);

    const decl = symbol.valueDeclaration;
    const flags = ts.getCombinedModifierFlags(decl);
github postmanlabs / newman / lib / reporters / cli / index.js View on Github external
var passed = !err;

        // handle skipped test display
        if (o.skipped && !reporterOptions.noSuccessAssertions) {
            print.lf('%s %s', colors.cyan('  - '), colors.cyan('[skipped] ' + o.assertion));
            return;
        }

        if (passed && reporterOptions.noSuccessAssertions) {
            return;
        }

        // print each test assertions
        print.lf('%s %s', passed ? colors.green(`  ${symbols.ok} `) :
            colors.red.bold(pad(this.summary.run.failures.length, 3, SPC) + symbols.dot), passed ?
            colors.gray(o.assertion) : colors.red.bold(o.assertion));
    });
github osmlab / name-suggestion-index / build_brands.js View on Github external
console.warn(colors.gray('If the brands are the different, add a disambiguator after the name, like `~(USA)` vs `~(Canada)`'));
    console.warn(colors.gray('If the brands are the same, remove extra `matchTags` or `matchNames`.  Remember:'));
    console.warn(colors.gray('- Name matching ignores letter case, punctuation, spacing, and diacritical marks (é vs e). '));
    console.warn(colors.gray('  No need to add `matchNames` for variations in these.'));
    console.warn(colors.gray('- Tag matching automatically includes other similar tags in the same match group.'));
    console.warn(colors.gray('  No need to add `matchTags` for similar tags.  see `config/match_groups.json`'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnMatched.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> matches? -> ' + colors.yellow('"' + w[1] + '"')
    ));
    console.warn('total ' + warnMatched.length);
  }

  if (warnMissingTag.length) {
    console.warn(colors.yellow('\nWarning - Missing tags for brands:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('To resolve these, add the missing tag.'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnMissingTag.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> missing tag? -> ' + colors.yellow('"' + w[1] + '"')
    ));
    console.warn('total ' + warnMissingTag.length);
  }

  if (warnFormatTag.length) {
    console.warn(colors.yellow('\nWarning - Unusual OpenStreetMap tag:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('To resolve these, make sure the OpenStreetMap tag is correct.'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnFormatTag.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> unusual tag? -> ' + colors.yellow('"' + w[1] + '"')
    ));
github mikemintz / rethinkdb-websocket-server / src / Connection.js View on Github external
log(msg, token) {
    const time = colors.blue(moment().format('HH:mm:ss.SSS'));
    const addr = colors.gray(this.remoteAddress + ':' + this.remotePort);
    const tokenStr = token ? colors.yellow(`tkn=${token} `) : '';
    console.log(`${time} ${addr} ${tokenStr}${msg}`);
  }
github osmlab / name-suggestion-index / build_brands.js View on Github external
}

  if (warnMissingTag.length) {
    console.warn(colors.yellow('\nWarning - Missing tags for brands:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('To resolve these, add the missing tag.'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnMissingTag.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> missing tag? -> ' + colors.yellow('"' + w[1] + '"')
    ));
    console.warn('total ' + warnMissingTag.length);
  }

  if (warnFormatTag.length) {
    console.warn(colors.yellow('\nWarning - Unusual OpenStreetMap tag:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('To resolve these, make sure the OpenStreetMap tag is correct.'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnFormatTag.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> unusual tag? -> ' + colors.yellow('"' + w[1] + '"')
    ));
    console.warn('total ' + warnFormatTag.length);
  }

  if (warnDuplicate.length) {
    console.warn(colors.yellow('\nWarning - Potential duplicate brand names:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('To resolve these, remove the worse entry and add `matchNames`/`matchTags` properties on the better entry.'));
    console.warn(colors.gray('To suppress this warning for entries that really are different, add a `nomatch` property on both entries.'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnDuplicate.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> duplicates? -> ' + colors.yellow('"' + w[1] + '"')
github osmlab / name-suggestion-index / build_brands.js View on Github external
if (warnFormatWikidata.length) {
    console.warn(colors.yellow('\nWarning - Brand with incorrect `brand:wikidata` format:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('To resolve these, make sure "brand:wikidata" tag looks like "Q191615".'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnFormatWikidata.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> "brand:wikidata": ' + '"' + w[1] + '"'
    ));
    console.warn('total ' + warnFormatWikidata.length);
  }

  if (warnFormatWikipedia.length) {
    console.warn(colors.yellow('\nWarning - Brand with incorrect `brand:wikipedia` format:'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    console.warn(colors.gray('To resolve these, make sure "brand:wikipedia" tag looks like "en:Pizza Hut".'));
    console.warn(colors.gray('--------------------------------------------------------------------------------'));
    warnFormatWikipedia.forEach(w => console.warn(
      colors.yellow('  "' + w[0] + '"') + ' -> "brand:wikipedia": ' + '"' + w[1] + '"'
    ));
    console.warn('total ' + warnFormatWikipedia.length);
  }

  const total = Object.keys(brands).length;
  const hasWd = total - warnMissingWikidata.length;
  const pctWd = (hasWd * 100 / total).toFixed(1);
  const hasLogos = total - warnMissingLogos.length;
  const pctLogos = (hasLogos * 100 / total).toFixed(1);

  console.info(colors.blue.bold(`\nIndex completeness:`));
  console.info(colors.blue.bold(`  ${total} entries total.`));
  console.info(colors.blue.bold(`  ${hasWd} (${pctWd}%) with a 'brand:wikidata' tag.`));
github aws / jsii / packages / jsii / lib / assembler.ts View on Github external
private async _visitClass(type: ts.Type, ctx: EmitContext): Promise {
    if (LOG.isTraceEnabled()) {
      LOG.trace(`Processing class: ${colors.gray(ctx.namespace.join('.'))}.${colors.cyan(type.symbol.name)}`);
    }

    if (_hasInternalJsDocTag(type.symbol)) {
      return undefined;
    }

    this._warnAboutReservedWords(type.symbol);

    const fqn = `${[this.projectInfo.name, ...ctx.namespace].join('.')}.${type.symbol.name}`;

    const jsiiType: spec.ClassType = {
      assembly: this.projectInfo.name,
      fqn,
      kind: spec.TypeKind.Class,
      name: type.symbol.name,
      namespace: ctx.namespace.length > 0 ? ctx.namespace.join('.') : undefined,