How to use the ansi-styles.green 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 ant-design / ant-design / scripts / sort-api-table.js View on Github external
.then(() => {
    /* eslint-disable no-console */
    console.log(`${style.green.open}sort ant-design api successfully!${style.green.close}`);
    /* eslint-enable no-console */
  });
github kubesail / deploy-node-app / index.js View on Github external
const DNA_VERSION = '0.0.1'
const USAGE = '[env]'

const homedir = require('os').homedir()
const path = require('path')
// eslint-disable-next-line security/detect-child-process
const execSync = require('child_process').execSync
const getKubesailConfig = require('get-kubesail-config')
const inquirer = require('inquirer')
inquirer.registerPrompt('fuzzypath', require('inquirer-fuzzy-path'))
const fs = require('fs')
const program = require('commander')
const yaml = require('js-yaml')
const style = require('ansi-styles')
const errArrows = `${style.red.open}>>${style.red.close}`
const warning = `${style.green.open}!!${style.green.close}`

const NEW_KUBESAIL_CONTEXT = `KubeSail${style.gray.open} | Deploy on a free Kubernetes namespace${
  style.gray.close
}`
const KUBESAIL_REGISTRY = 'registry.kubesail.io'
const KUBE_CONFIG_PATH = path.join(homedir, '.kube', 'config')

const execToStdout = { stdio: [process.stdin, process.stdout, process.stderr] }

function fatal (message /*: string */) {
  process.stderr.write(`${errArrows} ${message}\n`)
  process.exit(1)
}

const packageJsonPath = 'package.json'
github saul / demofile / dist / examples / dumpfile.js View on Github external
// tslint:disable:no-console
Object.defineProperty(exports, "__esModule", { value: true });
// This file is an thorough example of how to log player kills,
// team scores, chat text and server cvar changes from a demo file.
const ansiStyles = require("ansi-styles");
const assert = require("assert");
const fs = require("fs");
const util = require("util");
const demo = require("../demo");
const player_1 = require("../entities/player");
const colourReplacements = [
    { pattern: /\x01/g, ansi: ansiStyles.whiteBright.open },
    { pattern: /\x02/g, ansi: ansiStyles.red.open },
    { pattern: /\x03/g, ansi: ansiStyles.magenta.open },
    { pattern: /\x04/g, ansi: ansiStyles.greenBright.open },
    { pattern: /\x05/g, ansi: ansiStyles.green.open },
    { pattern: /\x06/g, ansi: ansiStyles.greenBright.open },
    { pattern: /\x07/g, ansi: ansiStyles.redBright.open },
    { pattern: /\x08/g, ansi: ansiStyles.gray.open },
    { pattern: /\x09/g, ansi: ansiStyles.yellowBright.open },
    { pattern: /\x0A/g, ansi: ansiStyles.white.open },
    { pattern: /\x0B/g, ansi: ansiStyles.blueBright.open },
    { pattern: /\x0C/g, ansi: ansiStyles.blue.open },
    { pattern: /\x0D/g, ansi: ansiStyles.magenta.open },
    { pattern: /\x0E/g, ansi: ansiStyles.magentaBright.open },
    { pattern: /\x0F/g, ansi: ansiStyles.red.open },
    { pattern: /\x10/g, ansi: ansiStyles.yellow.open } // Orange
];
const standardMessages = {
    Cstrike_Chat_All: "\x03%s\x01 : %s",
    Cstrike_Chat_AllDead: "*DEAD* \x03%s\x01 : %s",
    Game_connected: "%s connected."
github rvagg / archived-npm-explicit-deps / bin / npm-explicit-deps.js View on Github external
keys.forEach(function (k, i) {
        var oldv = oldJson[depType][k]
          , newv = newJson[depType][k]

        if (oldv == newv)
          return console.log('     "%s": "%s"%s', k, oldv, i + 1 == keys.length ? '' : ',')

        console.log('%s-    "%s": "%s"%s%s', ansi.red.open, k, oldv, i + 1 == keys.length ? '' : ',', ansi.red.close)
        console.log('%s+    "%s": "%s"%s%s', ansi.green.open, k, newv, i + 1 == keys.length ? '' : ',', ansi.green.close)
      })
github master-atul / byemck / src / ansi / animations / hello / index.js View on Github external
const hello = (text = '') => `
${symbols.PAGE_BREAK} 
Hi ${text}
${style.green.open}Hello Green!${style.green.close}
${style.red.open}Hello Red!${style.red.close}
\n`;
github serverless / components / registry / github-webhook / src / diff-options.js View on Github external
line: { open: forceColor.white("'"), close: forceColor.white("'") },
    multiline: { start: forceColor.white('`'), end: forceColor.white('`') },
    controlPicture: ansiStyles.grey,
    diff: {
      insert: {
        open: ansiStyles.bgGreen.open + ansiStyles.black.open,
        close: ansiStyles.black.close + ansiStyles.bgGreen.close
      },
      delete: {
        open: ansiStyles.bgRed.open + ansiStyles.black.open,
        close: ansiStyles.black.close + ansiStyles.bgRed.close
      },
      equal: ansiStyles.white,
      insertLine: {
        open: ansiStyles.green.open,
        close: ansiStyles.green.close
      },
      deleteLine: {
        open: ansiStyles.red.open,
        close: ansiStyles.red.close
      }
    }
  },
  symbol: ansiStyles.yellow,
  typedArray: {
    bytes: ansiStyles.yellow
  },
  undefined: ansiStyles.yellow
}

const plugins = []
const theme = colorTheme
github adelsz / inquirer-fuzzy-path / index.js View on Github external
function getPaths(
  rootPath,
  pattern,
  excludePath,
  excludeFilter,
  itemType,
  defaultItem,
  depthLimit,
) {
  const fuzzOptions = {
    pre: style.green.open,
    post: style.green.close,
  };

  async function listNodes(nodePath, level) {
    try {
      if (excludePath(nodePath)) {
        return [];
      }
      const nodes = await readdir(nodePath);
      const currentNode = (itemType !== 'file' ? [nodePath] : []);
      if (
        nodes.length > 0
        && (depthLimit === undefined || level >= 0)
      ) {
        const nodesWithPath = nodes.map(
          nodeName => listNodes(
github adelsz / inquirer-fuzzy-path / index.js View on Github external
function getPaths(
  rootPath,
  pattern,
  excludePath,
  excludeFilter,
  itemType,
  defaultItem,
  depthLimit,
) {
  const fuzzOptions = {
    pre: style.green.open,
    post: style.green.close,
  };

  async function listNodes(nodePath, level) {
    try {
      if (excludePath(nodePath)) {
        return [];
      }
      const nodes = await readdir(nodePath);
      const currentNode = (itemType !== 'file' ? [nodePath] : []);
      if (
        nodes.length > 0
        && (depthLimit === undefined || level >= 0)
      ) {
        const nodesWithPath = nodes.map(
          nodeName => listNodes(
            path.join(nodePath, nodeName),
github magda-io / magda / scripts / create-secrets / prompts / inquirer-fuzzy-path.js View on Github external
function getPaths(rootPath, pattern, pathFilter) {
    const fuzzOptions = {
        pre: style.green.open,
        post: style.green.close
    };

    function nodeOption(nodePath, isDirectory) {
        return pathFilter(isDirectory, nodePath) ? [nodePath] : [];
    }

    async function listNodes(nodePath, depth = 0) {
        try {
            if (depth >= maxScanDepth) {
                return nodeOption(nodePath, false);
            }
            const nodes = await readdir_(nodePath);
            const currentNode = nodeOption(nodePath, true);
            if (nodes.length > 0) {
                const nodex = nodes.map(dirName =>
                    listNodes(path.join(nodePath, dirName), depth + 1)