How to use the colors.bold 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 DmitrySoshnikov / hdl-js / src / bin / hdl-js-cli.js View on Github external
function describeGate(gate, formatRadix, formatStringLengh, columns) {
  const {run} = options;

  const GateClass = loadGate(gate);
  const isBuiltIn = Object.getPrototypeOf(GateClass) === BuiltInGate;
  const isKeyboard = isBuiltIn && GateClass.name === 'Keyboard';
  const spec = GateClass.Spec;

  console.info('');
  console.info(
    (isBuiltIn ? 'BuiltIn ' : 'Custom ') +
      colors.bold(`"${GateClass.name}"`) +
      ' gate:'
  );

  const toFullName = name => {
    const isSimple = typeof name === 'string' || name.size === 1;
    return (name = isSimple
      ? `  - ${name.name || name}`
      : `  - ${name.name}[${name.size}]`);
  };

  // Description:

  const description = spec.description
    .split('\n')
    .map(line => '  ' + line)
    .join('\n');
github DmitrySoshnikov / hdl-js / src / bin / hdl-js-cli.js View on Github external
return value;
        },
      });
    };

    if (run) {
      console.info(colors.bold('\nCurrent results for pins:'), '\n');
      runSlice(data, 0, printTable);
      return;
    }

    const {result, conflicts} = gateInstance.execOnData(data);

    if (conflicts.length) {
      console.info(
        colors.red(colors.bold(`\nFound ${conflicts.length} conflicts in:\n`))
      );

      conflicts.forEach(conflict => {
        const {row, pins} = conflict;
        const pinNames = Object.keys(pins);

        conflictingRows[row] = pins;

        console.info(`  - row: ${row}, pins: ${pinNames.join(', ')}`);
      });
      console.info('');
    } else {
      // No conflicts.
      console.info(colors.bold('\nTruth table for data:'), '\n');
    }
github DmitrySoshnikov / hdl-js / src / bin / hdl-js-cli.js View on Github external
: '    None';

  if (isKeyboard) {
    inputPins = '    Keyboard input';
  }

  console.info('\n' + colors.bold('Inputs:\n\n') + inputPins);

  // Internal pins:

  if (spec.internalPins && spec.internalPins.length > 0) {
    const internalPins = spec.internalPins
      .map(internal => toFullName(internal))
      .join('\n');

    console.info('\n' + colors.bold('Internal pins:\n\n') + internalPins);
  }

  // Output pins:

  const outputPins = spec.outputPins
    .map(output => toFullName(output))
    .join('\n');

  console.info('\n' + colors.bold('Outputs:\n\n') + outputPins);
  console.info('');

  // Special truth table for Keyboard.
  if (isKeyboard) {
    const keyboard = GateClass.defaultFromSpec().listen();

    console.info(colors.bold('Truth table:') + ' press any key...\n');
github zapier / zapier-platform-cli / src / commands / _access.js View on Github external
// Invitees can get access to specific versions only
        if (recordType === 'invitee') {
          columns.push(['Version', 'app_version']);
          // Clean up "null" in app_version
          _.each(
            _.get(data, 'invitees', []),
            invitee => (invitee.app_version = invitee.app_version || 'All')
          );
        }
        utils.printData(data[recordTypePlural], columns, ifEmpty);

        if (data && data.invite_url) {
          context.line();
          context.line(
            'You can invite users to this app more broadly by sharing this URL:\n\n  ' +
              colors.bold(data.invite_url)
          );
        }

        if (
          data &&
          data.versions_invite_urls &&
          Object.keys(data.versions_invite_urls).length
        ) {
          context.line();
          context.line('Or you can invite users to a specific version:\n');
          _.each(data.versions_invite_urls, (invite_url, _version) => {
            context.line(`  ${_version}: ${colors.bold(invite_url)}`);
          });
        }
      });
    }
github sblaurock / crypticker / index.js View on Github external
// Set precision based on amount
        if (changePercentage >= 100) {
          changePercentageFixed = changePercentage.toFixed(0);
        } else if (changePercentage >= 10) {
          changePercentageFixed = changePercentage.toFixed(1);
        } else {
          changePercentageFixed = changePercentage.toFixed(2);
        }

        // Show primary currency name
        if (previousPrimaryCurrency !== primaryCurrency) {
          primaryCurrencyOutput = colors.bold.white(` › ${primaryCurrency}`) + pad(options.app.padding, '');
          previousPrimaryCurrency = primaryCurrency;
        } else {
          primaryCurrencyOutput = colors.bold(pad(3 + 3, '')) + pad(options.app.padding, '');
        }

        // Show secondary currency name
        if (previousSecondaryCurrency !== secondaryCurrency) {
          secondaryCurrencyOutput = secondaryCurrency + pad(options.app.padding, '');
          previousSecondaryCurrency = secondaryCurrency;
        } else {
          secondaryCurrencyOutput = pad(3, '') + pad(options.app.padding, '');
        }

        // Show exchange name
        exchangeOutput = pad(exchange, outputData.longestExchangeLength) + pad(options.app.padding, '');

        // Show percent change in last 24 hours
        if (utility.fixed(exchangePriceData.price.change.percentage * 100, 2) > 0) {
          changeOutput = pad(colors.green(`▲ ${changePercentageFixed.toString()}%`), 15);
github hevans90 / oa3-api-defender / src / endpoint-validator.ts View on Github external
statusMessage: string,
    serverError?: boolean,
    valError?: ValidationError,
  ): void {
    if (valError) {
      console.log(
        `${op.toUpperCase()} ${colors.bold.green(
          path,
        )}: ${statusCode} - ${colors.underline.bold.red(
          `${valError.data.length} problems found`,
        )}:`,
      );
      console.log('');
    } else if (serverError) {
      console.log(
        `${op.toUpperCase()} ${colors.bold.bgRed(path)}: ${colors.bold(
          `${statusCode}`,
        )} - ${statusMessage}`,
      );
    } else {
      console.log(
        `${op.toUpperCase()} ${colors.bold.green(
          path,
        )}: ${statusCode} - no problems found`,
      );
    }
  }
github hubtype / botonic / packages / botonic-cli / src / commands / run.ts View on Github external
extra_data: {}
    },
    organization: '',
    bot: {
      id: '0000000',
      name: 'botName'
    }
  }
  private helpText: string = `
This is an interactive chat session with your bot.

Type anything and press enter to get a response.
Use ! to send a payload message.

Examples:
[user]> ${colors.bold(
    'hi'
  )} --> this will send a message of type 'text' and content 'hi'
[user]> ${colors.bold(
    '!button_click_1'
  )} --> this will send a message of type 'postback' and payload 'button_click_1'

Use / for special commands:
${colors.bold('/quit')} | ${colors.bold('/q')} --> Exit interactive session
${colors.bold('/help')} | ${colors.bold('/h')} --> Show this help`

  private botonicApiService: BotonicAPIService = new BotonicAPIService()

  async run() {
    track('Run Botonic CLI')
    const { args, flags } = this.parse(Run)
    const path = flags.path ? resolve(flags.path) : process.cwd()
github iceroad / martinet / lib / util / syncDir.js View on Github external
function ConditionalCopy(srcFile, destPath) {
  const newHash = hashcache(srcFile);
  let currentHash;
  if (fs.existsSync(destPath)) {
    currentHash = hashcache(destPath);
  }
  if (currentHash !== newHash) {
    fse.ensureDirSync(path.dirname(destPath));
    fse.copySync(srcFile, destPath);
    log.verbose(`Copied ${col.bold(srcFile)}${col.bold(destPath)}`.yellow);
    return 1;
  }

  log.verbose(`Unchanged ${srcFile}`.gray);
  return 0;
}
github DmitrySoshnikov / hdl-js / src / emulator / hardware / builtin-gates / DRegister.js View on Github external
*/
DRegister.Spec = {
  name: 'DRegister',

  description: `16-bit D (Data) register.

If load[t]=1 then out[t+1] = in[t] else out does not change.

Clock rising edge updates the value from the input,
if the \`load\` is set; otherwise, preserves the state.

  ${colors.bold('↗')} : value = load ? in : value

Clock falling edge propagates the value to the output:

  ${colors.bold('↘')} : out = value
`,

  inputPins: [{name: 'in', size: 16}, {name: 'load', size: 1}],
  outputPins: [{name: 'out', size: 16}],

  truthTable: Register.Spec.truthTable,
};

module.exports = DRegister;