ansicolor
Advanced tools
Comparing version 1.1.76 to 1.1.77
{ | ||
"name": "ansicolor", | ||
"version": "1.1.76", | ||
"version": "1.1.77", | ||
"description": "A JavaScript ANSI color/style management. ANSI parsing. ANSI to CSS. Small, clean, no dependencies.", | ||
@@ -5,0 +5,0 @@ "main": "./build/ansicolor.js", |
@@ -45,18 +45,18 @@ # ansicolor | ||
### Safe Mode (default) | ||
### Safe Mode (recommended) | ||
```javascript | ||
ansi = require ('ansicolor') | ||
const { green, inverse, bgLightCyan, underline, dim } = require ('ansicolor') | ||
``` | ||
```javascript | ||
console.log ('foo' + ansi.green (ansi.inverse (ansi.bgLightCyan ('bar')) + 'baz') + 'qux') | ||
console.log ('foo' + green (inverse (bgLightCyan ('bar')) + 'baz') + 'qux') | ||
``` | ||
```javascript | ||
console.log (ansi.underline.bright.green ('foo' + ansi.dim.red.bgLightCyan ('bar'))) // method chaining | ||
console.log (underline.bright.green ('foo' + dim.red.bgLightCyan ('bar'))) // method chaining | ||
``` | ||
### Nice Mode (by request) | ||
### Nice Mode | ||
```javascript | ||
ansi = require ('ansicolor').nice | ||
const ansi = require ('ansicolor').nice | ||
``` | ||
@@ -96,3 +96,5 @@ | ||
```javascript | ||
ansi.names // ['red', 'green', ... | ||
const { names } = require ('ansicolor') | ||
names // ['red', 'green', ... | ||
``` | ||
@@ -103,3 +105,5 @@ | ||
```javascript | ||
ansi.strip ('\u001b[0m\u001b[4m\u001b[42m\u001b[31mfoo\u001b[39m\u001b[49m\u001b[24mfoo\u001b[0m')) // 'foofoo' | ||
const { strip } = require ('ansicolor') | ||
strip ('\u001b[0m\u001b[4m\u001b[42m\u001b[31mfoo\u001b[39m\u001b[49m\u001b[24mfoo\u001b[0m')) // 'foofoo' | ||
``` | ||
@@ -112,3 +116,5 @@ | ||
```javascript | ||
const parsed = ansi.parse ('foo'.bgLightRed.bright.italic + 'bar'.red.dim) | ||
const { parse } = require ('ansicolor') | ||
const parsed = parse ('foo'.bgLightRed.bright.italic + 'bar'.red.dim) | ||
``` | ||
@@ -138,2 +144,4 @@ | ||
```javascript | ||
const ansi = require ('ansicolor') | ||
ansi.rgb = { | ||
@@ -171,5 +179,7 @@ | ||
```javascript | ||
const string = 'foo' + ('bar'.red.underline.bright.inverse + 'baz').bgGreen | ||
const parsed = ansi.parse (string) | ||
const { bgGreen, red, parse } = require ('ansicolor') | ||
const string = 'foo' + bgGreen (red.underline.bright.inverse ('bar') + 'baz') | ||
const parsed = parse (string) | ||
console.log (...parsed.asChromeConsoleLogArguments) // prints with colors in Chrome! | ||
@@ -176,0 +186,0 @@ ``` |
269420
199