How to use the ansi-styles.cyan function in ansi-styles

To help you get started, we’ve selected a few ansi-styles 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 misterfifths / jutil / colorizer.js View on Github external
'use strict';

const ansiStyles = require('ansi-styles');

const keyValueRE = /^(\s*)(?:(".*")(: ))?(.*?)(,?)$/,
      zeroCharCode = '0'.charCodeAt(0),
      nineCharCode = '9'.charCodeAt(0);

const stylesByType = {
    str: ansiStyles.yellow,
    bool: ansiStyles.blue,
    null: ansiStyles.red,
    num: ansiStyles.cyan
};

function applyStyle(style, s)
{
    return style.open + s + style.close;
}

function colorizeValue(s)
{
    // This function is fed values as extracted from the regex - no whitespace and
    // no trailing comma. That means there are preciously few options for what we
    // get, and we can judge our response based entirely on the first character.

    const firstChar = s.charAt(0);

    // pass through braces
github kubesail / deploy-node-app / src / util.js View on Github external
`${style.red.open}>> deploy-node-app requires kubectl v1.14 or higher.${style.red.close}\n\n`
        )
        process.stdout.write('You can fix this ')

        const install = chalk.cyan('brew install kubernetes-cli')
        const upgrade = chalk.cyan('brew upgrade kubernetes-cli')
        let cmd
        switch (process.platform) {
          case 'darwin':
            cmd = `${install}\n\nor\n\n  ${upgrade}`
            process.stdout.write(
              `by running\n\n  ${cmd}\n\nor by following the instructions at https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-macos\n`
            )
            break
          case 'linux':
            cmd = `${style.cyan.open}sudo apt-get install kubectl${style.reset.open}`
            process.stdout.write(
              `by running\n\n  ${cmd}\n\nor by following the instructions at https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-linux\n`
            )
            break
          case 'win32':
            cmd = `${style.cyan.open}choco install kubernetes-cli${style.reset.open}`
            process.stdout.write(
              `by running \n\n  ${cmd}\n\nor by following the instructions at https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-windows\n`
            )
            break
          default:
            process.stdout.write(
              'by following the instructions at https://kubernetes.io/docs/tasks/tools/install-kubectl/'
            )
        }
        process.exit(1)