How to use the colors/safe.blue 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 DonJayamanne / pythonVSCode / build / ci / postInstall.ts View on Github external
'@jupyterlab',
        'coreutils',
        'lib',
        'settingregistry.d.ts'
    );
    const filePath = path.join(
        ExtensionRootDir, relativePath
    );
    if (!fs.existsSync(filePath)) {
        throw new Error(`Type Definition file from JupyterLab not found '${filePath}' (pvsc post install script)`);
    }

    const fileContents = fs.readFileSync(filePath, { encoding: 'utf8' });
    if (fileContents.indexOf('[key: string]: ISchema | undefined;') > 0) {
        // tslint:disable-next-line:no-console
        console.log(colors.blue(`${relativePath} file already updated (by Python VSC)`));
        return;
    }
    if (fileContents.indexOf('[key: string]: ISchema;') > 0) {
        const replacedText = fileContents.replace('[key: string]: ISchema;', '[key: string]: ISchema | undefined;');
        if (fileContents === replacedText) {
            throw new Error('Fix for JupyterLabl file \'settingregistry.d.ts\' failed (pvsc post install script)');
        }
        fs.writeFileSync(filePath, replacedText);
        // tslint:disable-next-line:no-console
        console.log(colors.green(`${relativePath} file updated (by Python VSC)`));
    } else {
        // tslint:disable-next-line:no-console
        console.log(colors.red(`${relativePath} file does not need updating.`));
    }
}
github santinic / how2 / lib / how2.js View on Github external
function selectAnswer({
    title,
    text,
    answers,
    lang,
    index,
    remember
}) {
    spinner.stop();
    if (answers.length === 0) {
        log.error('Cannot find any reasonable answer for your query.');
        if (!lang) {
            console.log(`To get the best answers, make sure you specify the language with ${colors.blue('-l:')}`);
            console.log(`example: $ how2 ${colors.blue('-l python')} permutations list`);
            console.log(`example: $ how2 ${colors.blue('-l ruby')} permutations list`);
        }
        process.exit(1);
    }

    const markdown = utils.toEscapedMarkdown(answers[index].body_markdown);

    console.log(colors.underline.green(`${title}\n`));
    console.log(markdown);


    console.log(`(${colors.underline.blue(answers[index].link)})\n`);

    console.log('Press SPACE for more choices, any other key to quit.');
    require('keypress')(process.stdin);
    process
github charlieschwabacher / gestalt / packages / gestalt-postgres / src / DB.js View on Github external
exec(
    query: string,
    escapes?: ?mixed[]
  ): Promise {
    if (this.log) {
      console.log(
        green(query),
        blue(JSON.stringify(escapes))
      );
    }

    return new Promise((resolve, reject) => {
      pg.connect(this.url, (err, client, done) => {
        if (err) {
          reject(err);
        }
        client.query(query, escapes, (err, result) => {
          if (err) {
            reject(err);
          }
          resolve(result);
          done();
        });
      });
github HansHammel / license-compatibility-checker / lib / index.js View on Github external
function check(pathOfPackageJson,pathOfModules, cb) {
	var incompat = false;
	var pkg = require(pathOfPackageJson);
	var output = [];
	var noLicenseStr = colors.red('No license');
	var pkgLicense = pkg.license ? ((typeof pkg.license === 'string' || pkg.license instanceof String) ? pkg.license : pkg.license.type || pkgLicense) : pkgLicense;
	pkgLicense = pkgLicense ? pkgLicense : (pkg.licenses && pkg.licenses[0] && pkg.licenses[0].type ? ((typeof pkg.licenses[0].type === 'string' || pkg.licenses[0].type instanceof String) ? pkg.licenses[0].type : pkg.licenses.type || pkgLicense) : pkgLicense);
	var pkgLicenseType = license_type(pkgLicense);
	output.push(colors.yellow('Checking', colors.blue(pkgLicense ? pkgLicense : noLicenseStr), '(' + pkgLicenseType + ')', 'of', pkg.name + '@' + pkg.version, os.EOL, 'in', colors.blue(path.resolve(pathOfPackageJson)), os.EOL, 'against', colors.blue(path.resolve(pathOfModules)) + ':'));
	output.push('');
	var pkgCompatiblityString;
	if (pkgLicenseType === licenseTypes.unknown || pkgLicenseType === licenseTypes.unlicensed) {
		incompat = true;
		pkgCompatiblityString = 'possibly incompatible';
	} else {
		pkgCompatiblityString = 'incompatible';
	}

	fs.readdir(pathOfModules, function (err, dirs) {
		if (err) {
			console.log(err);
			cb(err, null, null);
		}
		var progress = 0;
		var total = dirs.length;
github imcuttle / directory-tree / index.js View on Github external
return a.name.localeCompare(b.name)
                return sort=='dir' ? -1 : 1
            } else {
                if(b.isDirectory())
                    return sort=='dir' ? 1 : -1
                return a.name.localeCompare(b.name)
            }
        } else {
            return a.name.localeCompare(b.name)
        }
    })
    
    let outString = level==1 ? SP + path.basename(path.resolve(dirname)) + theme.dir_suffix  : ''

    if(outString!='') {
        isLine && console.log(colors.blue(outString))
        outString = newLine(outString)
    }


    var tree = stats.reduce((prev, next, index, all) => {

        let newDepthArr = level==1 ? [] : depth.slice(0)
        let isLast = index == stats.length-1

        let str = makeFileLineStr(newDepthArr, isLast, next)

        isLine && console.log(colors.blue(str))

        prev += newLine(str)

        if(next.isDirectory()) {
github lepisma / blackbird / bin / blackbird-setup.js View on Github external
type: "string",
            conform: function(value) {
                try {
                    fs.statSync(value);
                    return true;
                }
                catch (err) {
                    return false;
                }
            },
            message: "Invalid path",
            default: config.beets.config
        },
        {
            name: "lfmEnable",
            description: colors.blue("Do you wish to enable last.fm integration ?"),
            required: true,
            type: "string",
            conform: function(value) {
                if (["y", "yes", "n", "no"].indexOf(value) > -1) {
                    return true;
                }
                else {
                    return false;
                }
            },
            message: "Respond in either y (yes) or n (no)",
            before: function(value) {
                return value[0];
            },
            default: "n"
        },
github diesdasdigital / csslint / bin / index.js View on Github external
function checkIfAnimationStartsWithComponentName(fileName, node) {
  const componentName = toComponentName(fileName);

  if (node.type === "Atrule" && node.name === "keyframes") {
    const animationName = node.prelude.children.first().name;

    if (!animationName.startsWith(`${componentName}__`)) {
      return `  ${colors.underline(`on line ${node.loc.start.line}:`)}
  The animation name ${colors.red(animationName)}
  does not start with the component name.
  The name of the file is ${colors.blue(fileName)}.
  The animation name should start with ${colors.blue(`${componentName}__`)}`;
    }
  }

  return "no error";
}
github Angelmmiguel / svgi / lib / utils / nodeTypes.js View on Github external
const colorizeCategory = (text, category) => {
    switch(category) {
    case 'animation':
      output = colors.red(text);
      break;
    case 'shapes':
      output = colors.green(text);
      break;
    case 'containers':
      output = colors.yellow(text);
      break;
    case 'descriptive':
      output = colors.blue(text);
      break;
    case 'filters':
      output = colors.magenta(text);
      break;
    case 'font':
      output = colors.cyan(text);
      break;
    case 'gradient':
      output = colors.underline.red(text);
      break;
    case 'html':
      output = colors.underline.green(text);
      break;
    case 'lights':
      output = colors.underline.yellow(text);
      break;
github Widen / cloudfront-auth / build / build.js View on Github external
function auth0Configuration() {
  prompt.message = colors.blue(">>");
  prompt.start();
  prompt.get({
    properties: {
      BASE_URL: {
        message: colors.red("Base URL"),
        required: true,
        default: R.pathOr('', ['BASE_URL'], oldConfig)
      },
      CLIENT_ID: {
        message: colors.red("Client ID"),
        required: true,
        default: R.pathOr('', ['AUTH_REQUEST', 'client_id'], oldConfig)
      },
      CLIENT_SECRET: {
        message: colors.red("Client Secret"),
        required: true,
github facebook / jscodeshift / src / Runner.js View on Github external
function showStats(stats) {
  const names = Object.keys(stats).sort();
  if (names.length) {
    process.stdout.write(colors.blue('Stats: \n'));
  }
  names.forEach(name => process.stdout.write(name + ': ' + stats[name] + '\n'));
}