diff options
Diffstat (limited to 'node_modules/kleur')
-rw-r--r-- | node_modules/kleur/index.js | 104 | ||||
-rw-r--r-- | node_modules/kleur/kleur.d.ts | 45 | ||||
-rw-r--r-- | node_modules/kleur/license | 21 | ||||
-rw-r--r-- | node_modules/kleur/package.json | 35 | ||||
-rw-r--r-- | node_modules/kleur/readme.md | 172 |
5 files changed, 0 insertions, 377 deletions
diff --git a/node_modules/kleur/index.js b/node_modules/kleur/index.js deleted file mode 100644 index 0bc6ec9..0000000 --- a/node_modules/kleur/index.js +++ /dev/null @@ -1,104 +0,0 @@ -'use strict'; - -const { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = process.env; - -const $ = { - enabled: !NODE_DISABLE_COLORS && TERM !== 'dumb' && FORCE_COLOR !== '0', - - // modifiers - reset: init(0, 0), - bold: init(1, 22), - dim: init(2, 22), - italic: init(3, 23), - underline: init(4, 24), - inverse: init(7, 27), - hidden: init(8, 28), - strikethrough: init(9, 29), - - // colors - black: init(30, 39), - red: init(31, 39), - green: init(32, 39), - yellow: init(33, 39), - blue: init(34, 39), - magenta: init(35, 39), - cyan: init(36, 39), - white: init(37, 39), - gray: init(90, 39), - grey: init(90, 39), - - // background colors - bgBlack: init(40, 49), - bgRed: init(41, 49), - bgGreen: init(42, 49), - bgYellow: init(43, 49), - bgBlue: init(44, 49), - bgMagenta: init(45, 49), - bgCyan: init(46, 49), - bgWhite: init(47, 49) -}; - -function run(arr, str) { - let i=0, tmp, beg='', end=''; - for (; i < arr.length; i++) { - tmp = arr[i]; - beg += tmp.open; - end += tmp.close; - if (str.includes(tmp.close)) { - str = str.replace(tmp.rgx, tmp.close + tmp.open); - } - } - return beg + str + end; -} - -function chain(has, keys) { - let ctx = { has, keys }; - - ctx.reset = $.reset.bind(ctx); - ctx.bold = $.bold.bind(ctx); - ctx.dim = $.dim.bind(ctx); - ctx.italic = $.italic.bind(ctx); - ctx.underline = $.underline.bind(ctx); - ctx.inverse = $.inverse.bind(ctx); - ctx.hidden = $.hidden.bind(ctx); - ctx.strikethrough = $.strikethrough.bind(ctx); - - ctx.black = $.black.bind(ctx); - ctx.red = $.red.bind(ctx); - ctx.green = $.green.bind(ctx); - ctx.yellow = $.yellow.bind(ctx); - ctx.blue = $.blue.bind(ctx); - ctx.magenta = $.magenta.bind(ctx); - ctx.cyan = $.cyan.bind(ctx); - ctx.white = $.white.bind(ctx); - ctx.gray = $.gray.bind(ctx); - ctx.grey = $.grey.bind(ctx); - - ctx.bgBlack = $.bgBlack.bind(ctx); - ctx.bgRed = $.bgRed.bind(ctx); - ctx.bgGreen = $.bgGreen.bind(ctx); - ctx.bgYellow = $.bgYellow.bind(ctx); - ctx.bgBlue = $.bgBlue.bind(ctx); - ctx.bgMagenta = $.bgMagenta.bind(ctx); - ctx.bgCyan = $.bgCyan.bind(ctx); - ctx.bgWhite = $.bgWhite.bind(ctx); - - return ctx; -} - -function init(open, close) { - let blk = { - open: `\x1b[${open}m`, - close: `\x1b[${close}m`, - rgx: new RegExp(`\\x1b\\[${close}m`, 'g') - }; - return function (txt) { - if (this !== void 0 && this.has !== void 0) { - this.has.includes(open) || (this.has.push(open),this.keys.push(blk)); - return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+''; - } - return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+''; - }; -} - -module.exports = $; diff --git a/node_modules/kleur/kleur.d.ts b/node_modules/kleur/kleur.d.ts deleted file mode 100644 index fdc26ca..0000000 --- a/node_modules/kleur/kleur.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Originally by: Rogier Schouten <https://github.com/rogierschouten> -// Adapted by: Madhav Varshney <https://github.com/madhavarshney> -declare namespace kleur { - interface Color { - (x: string | number): string; - (): Kleur; - } - - interface Kleur { - // Colors - black: Color; - red: Color; - green: Color; - yellow: Color; - blue: Color; - magenta: Color; - cyan: Color; - white: Color; - gray: Color; - grey: Color; - - // Backgrounds - bgBlack: Color; - bgRed: Color; - bgGreen: Color; - bgYellow: Color; - bgBlue: Color; - bgMagenta: Color; - bgCyan: Color; - bgWhite: Color; - - // Modifiers - reset: Color; - bold: Color; - dim: Color; - italic: Color; - underline: Color; - inverse: Color; - hidden: Color; - strikethrough: Color; - } -} - -declare let kleur: kleur.Kleur & { enabled: boolean }; -export = kleur; diff --git a/node_modules/kleur/license b/node_modules/kleur/license deleted file mode 100644 index a3f96f8..0000000 --- a/node_modules/kleur/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/kleur/package.json b/node_modules/kleur/package.json deleted file mode 100644 index a81931e..0000000 --- a/node_modules/kleur/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "kleur", - "version": "3.0.3", - "repository": "lukeed/kleur", - "description": "The fastest Node.js library for formatting terminal text with ANSI colors~!", - "license": "MIT", - "files": [ - "*.js", - "*.d.ts" - ], - "author": { - "name": "Luke Edwards", - "email": "luke.edwards05@gmail.com", - "url": "lukeed.com" - }, - "scripts": { - "test": "tape test/*.js | tap-spec" - }, - "engines": { - "node": ">=6" - }, - "keywords": [ - "ansi", - "cli", - "color", - "colors", - "console", - "terminal" - ], - "types": "kleur.d.ts", - "devDependencies": { - "tap-spec": "^5.0.0", - "tape": "^4.9.1" - } -} diff --git a/node_modules/kleur/readme.md b/node_modules/kleur/readme.md deleted file mode 100644 index 6926f1e..0000000 --- a/node_modules/kleur/readme.md +++ /dev/null @@ -1,172 +0,0 @@ -<div align="center"> - <img src="shots/logo.png" alt="kleur" height="120" /> -</div> - -<div align="center"> - <a href="https://npmjs.org/package/kleur"> - <img src="https://badgen.now.sh/npm/v/kleur" alt="version" /> - </a> - <a href="https://travis-ci.org/lukeed/kleur"> - <img src="https://badgen.now.sh/travis/lukeed/kleur" alt="travis" /> - </a> - <a href="https://npmjs.org/package/kleur"> - <img src="https://badgen.now.sh/npm/dm/kleur" alt="downloads" /> - </a> - <a href="https://packagephobia.now.sh/result?p=kleur"> - <img src="https://packagephobia.now.sh/badge?p=kleur" alt="install size" /> - </a> -</div> - -<div align="center">The fastest Node.js library for formatting terminal text with ANSI colors~!</div> - -## Features - -* No dependencies -* Super [lightweight](#load-time) & [performant](#performance) -* Supports [nested](#nested-methods) & [chained](#chained-methods) colors -* No `String.prototype` modifications -* Conditional [color support](#conditional-support) -* Familiar [API](#api) - ---- - -As of `v3.0` the Chalk-style syntax (magical getter) is no longer used.<br>If you need or require that syntax, consider using [`ansi-colors`](https://github.com/doowb/ansi-colors), which maintains `chalk` parity. - ---- - - -## Install - -``` -$ npm install --save kleur -``` - - -## Usage - -```js -const { red, white, blue, bold } = require('kleur'); - -// basic usage -red('red text'); - -// chained methods -blue().bold().underline('howdy partner'); - -// nested methods -bold(`${ white().bgRed('[ERROR]') } ${ red().italic('Something happened')}`); -``` - -### Chained Methods - -```js -console.log(bold().red('this is a bold red message')); -console.log(bold().italic('this is a bold italicized message')); -console.log(bold().yellow().bgRed().italic('this is a bold yellow italicized message')); -console.log(green().bold().underline('this is a bold green underlined message')); -``` - -<img src="shots/1.png" width="300" /> - -### Nested Methods - -```js -const { yellow, red, cyan } = require('kleur'); - -console.log(yellow(`foo ${red().bold('red')} bar ${cyan('cyan')} baz`)); -console.log(yellow('foo ' + red().bold('red') + ' bar ' + cyan('cyan') + ' baz')); -``` - -<img src="shots/2.png" width="300" /> - - -### Conditional Support - -Toggle color support as needed; `kleur` includes simple auto-detection which may not cover all cases. - -```js -const kleur = require('kleur'); - -// manually disable -kleur.enabled = false; - -// or use another library to detect support -kleur.enabled = require('color-support').level; - -console.log(kleur.red('I will only be colored red if the terminal supports colors')); -``` - - -## API - -Any `kleur` method returns a `String` when invoked with input; otherwise chaining is expected. - -> It's up to the developer to pass the output to destinations like `console.log`, `process.stdout.write`, etc. - -The methods below are grouped by type for legibility purposes only. They each can be [chained](#chained-methods) or [nested](#nested-methods) with one another. - -***Colors:*** -> black — red — green — yellow — blue — magenta — cyan — white — gray — grey - -***Backgrounds:*** -> bgBlack — bgRed — bgGreen — bgYellow — bgBlue — bgMagenta — bgCyan — bgWhite - -***Modifiers:*** -> reset — bold — dim — italic* — underline — inverse — hidden — strikethrough* - -<sup>* <em>Not widely supported</em></sup> - - -## Benchmarks - -> Using Node v10.13.0 - -### Load time - -``` -chalk :: 14.543ms -kleur :: 0.474ms -ansi-colors :: 1.923ms -``` - -### Performance - -``` -# All Colors - ansi-colors x 199,381 ops/sec ±1.04% (96 runs sampled) - chalk x 12,107 ops/sec ±2.07% (87 runs sampled) - kleur x 715,334 ops/sec ±0.30% (93 runs sampled) - -# Stacked colors - ansi-colors x 24,494 ops/sec ±1.03% (93 runs sampled) - chalk x 2,650 ops/sec ±2.06% (85 runs sampled) - kleur x 75,798 ops/sec ±0.19% (97 runs sampled) - -# Nested colors - ansi-colors x 77,766 ops/sec ±0.32% (94 runs sampled) - chalk x 5,596 ops/sec ±1.85% (86 runs sampled) - kleur x 137,660 ops/sec ±0.31% (93 runs sampled) -``` - - -## Credits - -This project originally forked [Brian Woodward](https://github.com/doowb)'s awesome [`ansi-colors`](https://github.com/doowb/ansi-colors) library. - -Beginning with `kleur@3.0`, the Chalk-style syntax (magical getter) has been replaced with function calls per key: - -```js -// Old: -c.red.bold.underline('old'); - -// New: -c.red().bold().underline('new'); -``` -> <sup><em>As I work more with Rust, the newer syntax feels so much better & more natural!</em></sup> - -If you prefer the old syntax, you may migrate to `ansi-colors`. Versions below `kleur@3.0` have been deprecated. - - -## License - -MIT © [Luke Edwards](https://lukeed.com) |