How to use the ansi-styles.reset 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 trabus / markdown-it-terminal / index.js View on Github external
module.exports = function terminal_plugin(md,options) {
  var defaultOptions = {
    styleOptions: {
      code: styles.yellow,
      blockquote: terminal.compoundStyle(['gray','italic']),
      html: styles.gray,
      heading: terminal.compoundStyle(['green','bold']),
      firstHeading: terminal.compoundStyle(['magenta','underline','bold']),
      hr: styles.reset,
      listitem: styles.reset,
      table: styles.reset,
      paragraph: styles.reset,
      strong: styles.bold,
      em: styles.italic,
      codespan: styles.yellow,
      del: terminal.compoundStyle(['dim','gray','strikethrough']),
      link: styles.blue,
      href: terminal.compoundStyle(['blue','underline'])
    },
    unescape: true
  };

  var opts = merge(defaultOptions, options);
  terminal(md,opts);
  // console.log(styles)
github trabus / markdown-it-terminal / index.js View on Github external
module.exports = function terminal_plugin(md,options) {
  var defaultOptions = {
    styleOptions: {
      code: styles.yellow,
      blockquote: terminal.compoundStyle(['gray','italic']),
      html: styles.gray,
      heading: terminal.compoundStyle(['green','bold']),
      firstHeading: terminal.compoundStyle(['magenta','underline','bold']),
      hr: styles.reset,
      listitem: styles.reset,
      table: styles.reset,
      paragraph: styles.reset,
      strong: styles.bold,
      em: styles.italic,
      codespan: styles.yellow,
      del: terminal.compoundStyle(['dim','gray','strikethrough']),
      link: styles.blue,
      href: terminal.compoundStyle(['blue','underline'])
    },
    unescape: true
  };

  var opts = merge(defaultOptions, options);
  terminal(md,opts);
  // console.log(styles)
};
github trabus / markdown-it-terminal / index.js View on Github external
module.exports = function terminal_plugin(md,options) {
  var defaultOptions = {
    styleOptions: {
      code: styles.yellow,
      blockquote: terminal.compoundStyle(['gray','italic']),
      html: styles.gray,
      heading: terminal.compoundStyle(['green','bold']),
      firstHeading: terminal.compoundStyle(['magenta','underline','bold']),
      hr: styles.reset,
      listitem: styles.reset,
      table: styles.reset,
      paragraph: styles.reset,
      strong: styles.bold,
      em: styles.italic,
      codespan: styles.yellow,
      del: terminal.compoundStyle(['dim','gray','strikethrough']),
      link: styles.blue,
      href: terminal.compoundStyle(['blue','underline'])
    },
    unescape: true
  };

  var opts = merge(defaultOptions, options);
  terminal(md,opts);
  // console.log(styles)
};
github saul / demofile / dist / examples / dumpfile.js View on Github external
function formatSayText(entityIndex, text) {
            text = "\x01" + text;
            // If we have an entity index set, colour 0x03 in that entity's team colour
            if (entityIndex > 0) {
                const ent = demoFile.entities.entities[entityIndex];
                if (ent instanceof player_1.Player) {
                    text = text.replace(/\x03/g, teamNumberToAnsi(ent.teamNumber));
                }
            }
            // Replace each colour code with its corresponding ANSI escape sequence
            for (const r of colourReplacements) {
                text = text.replace(r.pattern, ansiStyles.reset.open + r.ansi);
            }
            return text + ansiStyles.reset.open;
        }
        demoFile.on("start", () => {
github kubesail / deploy-node-app / src / util.js View on Github external
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)
      }
    } catch {
      fatal('Could not determine kubectl version')
    }
  }
}
github yeoman / yosay / index.js View on Github external
if (options.maxLength) {
    maxLength = stripAnsi(message).toLowerCase().split(' ').sort()[0].length;

    if (maxLength < options.maxLength) {
      maxLength = options.maxLength;
      TOTAL_CHARACTERS_PER_LINE = maxLength + YEOMAN_CHARACTER_WIDTH + topOffset;
    }
  }

  const regExNewLine = new RegExp(`\\s{${maxLength}}`);
  const borderHorizontal = border.horizontal.repeat(maxLength + 2);

  const frame = {
    top: border.topLeft + borderHorizontal + border.topRight,
    side: ansiStyles.reset.open + border.vertical + ansiStyles.reset.open,
    bottom: ansiStyles.reset.open + border.bottomLeft + borderHorizontal + border.bottomRight
  };

  message.replace(ansiRegex, (match, offset) => {
    Object.keys(styledIndexes).forEach(key => {
      offset -= styledIndexes[key].length;
    });

    styledIndexes[offset] = styledIndexes[offset] ? styledIndexes[offset] + match : match;
  });

  const strippedMessage = stripAnsi(message);
  const spacesIndex = [];

  strippedMessage.split(' ').reduce((accu, cur) => {
    spacesIndex.push(accu + cur.length);
github kubesail / deploy-node-app / index.js View on Github external
packageJson['deploy-node-app'] && packageJson['deploy-node-app'][env]
  )

  if (answers.context === NEW_KUBESAIL_CONTEXT) {
    const kubesailContext = await getKubesailConfig()
    answers.context = kubesailContext
  }

  buildDockerfile(answers.entrypoint)

  const tags = await getDeployTags(env, answers)

  process.stdout.write(
    `\n${warning} About to deploy ${style.green.open}${style.bold.open}${env}${
      style.green.close
    }: ${tags.env}${style.reset.open}\n\n`
  )

  if (!answers.confirmRegistry) {
    process.stdout.write(
      `${warning} If the docker registry does not exist, it may be automatically created with ${
        style.red.open
      }PUBLIC${style.red.close} access!\n` +
        '   Make sure you have all secrets in your ".dockerignore" file,\n' +
        '   and you may want to make sure your image repository is setup securely!\n\n'
    )

    const { confirm } = await inquirer.prompt([
      {
        name: 'confirm',
        type: 'confirm',
        message: 'Are you sure you want to continue?'
github dreamyguy / gitlogg / src / colors.js View on Github external
const styles = require('ansi-styles');

export const red = styles.red.open;
export const magenta = styles.magenta.open;
export const yellow = styles.yellow.open;
export const blue = styles.blue.open;
export const green = styles.green.open;
export const reset = styles.reset.open;
github yeoman / yosay / index.js View on Github external
valueOf() {
          return ansiStyles.reset.open + str + ansiStyles.reset.open;
        }
      }, maxLength);
github facebook / jest / packages / pretty-format / src / plugins / ConvertAnsi.js View on Github external
return text.replace(ansiRegex(), (match, offset, string) => {
    switch (match) {
      case style.red.close:
      case style.green.close:
      case style.reset.open:
      case style.reset.close:
        return '';
      case style.red.open:
        return '';
      case style.green.open:
        return '';
      case style.dim.open:
        return '';
      case style.bold.open:
        return '';
      default:
        return '';
    }
  });
};