Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansi-colors

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-colors - npm Package Compare versions

Comparing version 3.0.5 to 3.0.6

107

index.js
'use strict';
const colors = { enabled: true, visible: true, styles: {} };
const colors = { enabled: true, visible: true, styles: {}, keys: {} };

@@ -22,2 +22,3 @@ const ansi = codes => {

const style = (input, stack) => {
if (input === '') return '';
if (colors.enabled === false) return input;

@@ -32,4 +33,7 @@ if (colors.visible === false) return '';

const define = (name, codes) => {
const define = (name, codes, type) => {
colors.styles[name] = ansi(codes);
let t = colors.keys[type] || (colors.keys[type] = []);
t.push(name);
Reflect.defineProperty(colors, name, {

@@ -45,53 +49,62 @@ get() {

define('reset', [0, 0]);
define('bold', [1, 22]);
define('dim', [2, 22]);
define('italic', [3, 23]);
define('underline', [4, 24]);
define('inverse', [7, 27]);
define('hidden', [8, 28]);
define('strikethrough', [9, 29]);
define('reset', [0, 0], 'modifier');
define('bold', [1, 22], 'modifier');
define('dim', [2, 22], 'modifier');
define('italic', [3, 23], 'modifier');
define('underline', [4, 24], 'modifier');
define('inverse', [7, 27], 'modifier');
define('hidden', [8, 28], 'modifier');
define('strikethrough', [9, 29], 'modifier');
define('black', [30, 39]);
define('red', [31, 39]);
define('green', [32, 39]);
define('yellow', [33, 39]);
define('blue', [34, 39]);
define('magenta', [35, 39]);
define('cyan', [36, 39]);
define('white', [37, 39]);
define('gray', [90, 39]);
define('grey', [90, 39]);
define('black', [30, 39], 'color');
define('red', [31, 39], 'color');
define('green', [32, 39], 'color');
define('yellow', [33, 39], 'color');
define('blue', [34, 39], 'color');
define('magenta', [35, 39], 'color');
define('cyan', [36, 39], 'color');
define('white', [37, 39], 'color');
define('gray', [90, 39], 'color');
define('grey', [90, 39], 'color');
define('bgBlack', [40, 49]);
define('bgRed', [41, 49]);
define('bgGreen', [42, 49]);
define('bgYellow', [43, 49]);
define('bgBlue', [44, 49]);
define('bgMagenta', [45, 49]);
define('bgCyan', [46, 49]);
define('bgWhite', [47, 49]);
define('bgBlack', [40, 49], 'bg');
define('bgRed', [41, 49], 'bg');
define('bgGreen', [42, 49], 'bg');
define('bgYellow', [43, 49], 'bg');
define('bgBlue', [44, 49], 'bg');
define('bgMagenta', [45, 49], 'bg');
define('bgCyan', [46, 49], 'bg');
define('bgWhite', [47, 49], 'bg');
define('blackBright', [90, 39]);
define('redBright', [91, 39]);
define('greenBright', [92, 39]);
define('yellowBright', [93, 39]);
define('blueBright', [94, 39]);
define('magentaBright', [95, 39]);
define('cyanBright', [96, 39]);
define('whiteBright', [97, 39]);
define('blackBright', [90, 39], 'bright');
define('redBright', [91, 39], 'bright');
define('greenBright', [92, 39], 'bright');
define('yellowBright', [93, 39], 'bright');
define('blueBright', [94, 39], 'bright');
define('magentaBright', [95, 39], 'bright');
define('cyanBright', [96, 39], 'bright');
define('whiteBright', [97, 39], 'bright');
define('bgBlackBright', [100, 49]);
define('bgRedBright', [101, 49]);
define('bgGreenBright', [102, 49]);
define('bgYellowBright', [103, 49]);
define('bgBlueBright', [104, 49]);
define('bgMagentaBright', [105, 49]);
define('bgCyanBright', [106, 49]);
define('bgWhiteBright', [107, 49]);
define('bgBlackBright', [100, 49], 'bgBright');
define('bgRedBright', [101, 49], 'bgBright');
define('bgGreenBright', [102, 49], 'bgBright');
define('bgYellowBright', [103, 49], 'bgBright');
define('bgBlueBright', [104, 49], 'bgBright');
define('bgMagentaBright', [105, 49], 'bgBright');
define('bgCyanBright', [106, 49], 'bgBright');
define('bgWhiteBright', [107, 49], 'bgBright');
// ansiRegex modified from node.js readline: https://git.io/fNWFP
colors.ansiRegex = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
colors.unstyle = val => typeof val === 'string' ? val.replace(colors.ansiRegex, '') : val;
/* eslint-disable no-control-regex */
// ansiRegex modified from node.js readline: https://git.io/fNWFP, which itself
// is adopted from regex used for ansi escape code splitting in ansi-regex
// Adopted from https://github.com/chalk/ansi-regex/blob/master/index.js
// License: MIT, authors: @sindresorhus, Qix-, and arjunmehta Matches all
// ansi escape code sequences in a string
colors.ansiRegex = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/gm;
colors.hasAnsi = str => str && typeof str === 'string' && colors.ansiRegex.test(str);
colors.unstyle = str => typeof str === 'string' ? str.replace(colors.ansiRegex, '') : str;
colors.none = colors.clear = str => str; // noop, for programmatic usage
colors.stripColor = colors.unstyle;
colors.hasColor = colors.hasAnsi;
colors.symbols = require('./symbols');
module.exports = colors;
{
"name": "ansi-colors",
"description": "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).",
"version": "3.0.5",
"version": "3.0.6",
"homepage": "https://github.com/doowb/ansi-colors",

@@ -73,3 +73,2 @@ "author": "Brian Woodward (https://github.com/doowb)",

"strikethrough",
"turbocolor",
"underline",

@@ -106,6 +105,5 @@ "white",

"kleur",
"supports-color",
"turbocolor"
"supports-color"
]
}
}

@@ -182,4 +182,4 @@ # ansi-colors [![NPM version](https://img.shields.io/npm/v/ansi-colors.svg?style=flat)](https://www.npmjs.com/package/ansi-colors) [![NPM monthly downloads](https://img.shields.io/npm/dm/ansi-colors.svg?style=flat)](https://npmjs.org/package/ansi-colors) [![NPM total downloads](https://img.shields.io/npm/dt/ansi-colors.svg?style=flat)](https://npmjs.org/package/ansi-colors) [![Linux Build Status](https://img.shields.io/travis/doowb/ansi-colors.svg?style=flat&label=Travis)](https://travis-ci.org/doowb/ansi-colors) [![Windows Build Status](https://img.shields.io/appveyor/ci/doowb/ansi-colors.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/doowb/ansi-colors)

* ansi-colors - `2.383ms`
* chalk - `14.676ms`
* ansi-colors - `1.915ms`
* chalk - `12.437ms`

@@ -190,12 +190,12 @@ **Benchmarks**

# All Colors
ansi-colors x 171,138 ops/sec ±1.32% (91 runs sampled))
chalk x 9,140 ops/sec ±2.42% (82 runs sampled)))
ansi-colors x 173,851 ops/sec ±0.42% (91 runs sampled)
chalk x 9,944 ops/sec ±2.53% (81 runs sampled)))
# Chained colors
ansi-colors x 20,009 ops/sec ±1.35% (90 runs sampled)
chalk x 1,951 ops/sec ±1.65% (79 runs sampled)
ansi-colors x 20,791 ops/sec ±0.60% (88 runs sampled)
chalk x 2,111 ops/sec ±2.34% (83 runs sampled)
# Nested colors
ansi-colors x 59,232 ops/sec ±1.11% (93 runs sampled)
chalk x 3,995 ops/sec ±2.04% (82 runs sampled)
ansi-colors x 59,304 ops/sec ±0.98% (92 runs sampled)
chalk x 4,590 ops/sec ±2.08% (82 runs sampled)
```

@@ -275,5 +275,6 @@

| 35 | [doowb](https://github.com/doowb) |
| 23 | [jonschlinkert](https://github.com/jonschlinkert) |
| 26 | [jonschlinkert](https://github.com/jonschlinkert) |
| 6 | [lukeed](https://github.com/lukeed) |
| 2 | [Silic0nS0ldier](https://github.com/Silic0nS0ldier) |
| 1 | [jorgebucaran](https://github.com/jorgebucaran) |
| 1 | [madhavarshney](https://github.com/madhavarshney) |

@@ -297,2 +298,2 @@ | 1 | [chapterjason](https://github.com/chapterjason) |

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on August 23, 2018._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on September 20, 2018._

@@ -7,9 +7,16 @@ 'use strict';

const windows = {
bullet: '•',
check: '√',
cross: '×',
ellipsis: '...',
heart: '❤',
info: 'i',
line: '─',
middot: '·',
minus: '-',
plus: '+',
question: '?',
questionSmall: '﹖',
pointer: '>',
pointerSmall: '»',
question: '?',
warning: '‼'

@@ -19,9 +26,18 @@ };

const other = {
ballotCross: '✘',
bullet: '•',
check: '✔',
cross: '✖',
ellipsis: '…',
heart: '❤',
info: 'ℹ',
line: '─',
middot: '·',
minus: '-',
plus: '+',
question: '?',
questionFull: '?',
questionSmall: '﹖',
pointer: isLinux ? '▸' : '❯',
pointerSmall: isLinux ? '‣' : '›',
question: '?',
warning: '⚠'

@@ -28,0 +44,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc