How to use the ansi-colors.red function in ansi-colors

To help you get started, we’ve selected a few ansi-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 fourdigit / gulpset / bootstrap / index.js View on Github external
function checkProjectName(name, dependencies) {
  // Validate project name against NPM naming restriction
  // https://github.com/npm/cli/blob/latest/doc/files/package.json.md#name
  const validationResult = validateProjectName(name);
  if (!validationResult.validForNewPackages) {
    console.error(`Could not create a project called ${colors.red(`"${name}"`)} because of npm naming restrictions:`);
    printValidationResults(validationResult.errors);
    printValidationResults(validationResult.warnings);
    process.exit(1);
  }

  // Check if project name conflicts with existing NPM packages
  if (dependencies.indexOf(name) >= 0) {
    console.error(
      colors.red(`We cannot create a project called `) +
        colors.green(name) +
        colors.red(
          ` because a dependency with the same name exists.\n` +
            `Due to the way npm works, the following names are not allowed:\n\n`
        ) +
        colors.cyan(dependencies.map(depName => `  ${depName}`).join('\n')) +
        colors.red('\n\nPlease choose a different project name.')
    );
    process.exit(1);
  }
}
github wprig / wprig / gulp / prodPrep.js View on Github external
requiredConfigUpdates.map( (requiredConfigField) => {
        // Error if config that must be set is still the default value.
        if ( nameFieldDefaults[requiredConfigField] === config.theme[requiredConfigField] ){
            log(colors.red(`${colors.bold('Error:')} the theme ${requiredConfigField} must be different than the default value ${nameFieldDefaults[requiredConfigField]}.`));
            process.exit(1);
        }

    });
github angular-material-extensions / link-preview / gulpfile.js View on Github external
.catch(e => {
      fancyLog(acolors.red('ng-compilation failed. See below for errors.\n'));
      fancyLog(acolors.red(e));
      process.exit(1);
    });
});
github johnfmorton / generator-buildabanner / generators / app / templates / _gulpfile.babel.js View on Github external
fs.readFile('dev/index.html', 'utf8', function(err, theFileContents) {
      if (err) {
        log(c.red('*** metadata ad.size validation error encountered ***'));
        log(c.red(err));
      }
      var adSizeMetaData;
      var parser = new htmlparser.Parser({
        onopentag: function(name, attribs) {
          //log('opentag');
          if (name === "meta" && attribs.name === 'ad.size') {
            log(c.yellow('* Found ad.size metadata: ') + c.green(attribs.content));
            adSizeMetaData = attribs.content
            //log(attribs.content);
          }
        },
        ontext: function(text) {
          //console.log("-->", text);
        },
      }, { decodeEntities: true, recognizeSelfClosing: true });
github ivogabe / gulp-typescript / release / utils.js View on Github external
function message(title, alternative, description) {
    console.log(colors.red('gulp-typescript').toString() +
        colors.gray(': ') +
        title +
        colors.gray(' - ') +
        alternative);
    if (description)
        console.log('  ' + colors.gray(description.replace(/\n/g, '\n  ')));
}
exports.message = message;
github enquirer / enquirer / examples / multiselect / option-disabled.js View on Github external
'use strict';

const colors = require('ansi-colors');
const { MultiSelect } = require('enquirer');

const prompt = new MultiSelect({
  name: 'food',
  message: 'What are your favorite foods?',
  choices: [
    'Lasagna',
    'Pizza',
    {
      name: 'Funnel Cakes',
      disabled: colors.red('Not today!'),
      indicator: '-'
    },
    'Chicken Curry',
    'Tacos'
  ]
});

prompt.run()
  .then(console.log)
  .catch(console.log);
github stefanwalther / sense-go / lib / index.js View on Github external
function run(tasks) {

    process.emit('senseGo_onRunStart');
    try {
      gulp.series(tasks, function (done) {
        process.emit('senseGo_onRunFinished');
        process.emit('senseGo_onEnd');
        done();
      })();
    } catch (ex) {
      if (ex) {
        log(colors.red(ex.name), ex.message);
      }
    }
  }
github enquirer / enquirer / recipes / lazy-choices.js View on Github external
const render = async() => {
      this.clear();
      this.cursorHide();

      let waiting = red('Please wait until all choices are loaded');
      let value = this.selected ? cyan(this.selected.value) : '';
      let hint = !this.queue.length ? this.renderHelp(help) : waiting;

      this.write(this.renderHeader());
      this.write(this.renderMessage(value, help));
      this.write(await this.renderChoices());
      this.write(this.renderFooter());

      if (this.queue.length) {
        this.online = this.offline();
        let choice = await this.toChoice(this.queue.shift());
        this.choices.push(choice);
        this.str += '\n';
        return render();
      }
    };
github enquirer / enquirer / lib / utils / interpolate.js View on Github external
if (state.answered) {
          let result = format(state.values[key], choice, state);
          state.output += colors.unstyle(result);
          continue;
        }

        if (val !== value) {
          state.values[key] = val;
          value = colors.dim(val);

        } else {
          state.values[key] = '';
          val = `<${token.inner}>`;

          if (state.missing.has(key) || state.invalid.has(key)) {
            value = colors.red(val);
          } else {
            value = colors.cyan(val);
          }
        }

        if (index === state.index) {
          value = colors.underline(value);
        }

        index++;
      }

      if (value) {
        state.output += value;
      }
    }

ansi-colors

Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in replacement for chalk, kleur and turbocolor (without the dependencies and rendering bugs).

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis