diff options
author | isaacs <i@izs.me> | 2020-07-23 20:58:04 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2020-07-29 21:53:42 +0300 |
commit | ad5e07d8bd86d1dbe2b03dc142f8c8d6f4828ffe (patch) | |
tree | 97b66f97d77f35774f10a5e3e9957b1897d150bb /node_modules/colors | |
parent | a16994cfdd2f255016f3d8ee60d03473d80eabd8 (diff) |
Full dependency reboot
Reinstall everything from a clean node_modules and package-lock.json
state.
Re-generate list of bundleDependencies and node_modules/.gitignore with
a script that does the right thing based on actual dependency state.
Diffstat (limited to 'node_modules/colors')
-rw-r--r-- | node_modules/colors/README.md | 41 | ||||
-rw-r--r-- | node_modules/colors/examples/normal-usage.js | 1 | ||||
-rw-r--r-- | node_modules/colors/examples/safe-string.js | 2 | ||||
-rw-r--r-- | node_modules/colors/lib/colors.js | 14 | ||||
-rw-r--r-- | node_modules/colors/lib/maps/random.js | 3 | ||||
-rw-r--r-- | node_modules/colors/lib/styles.js | 18 | ||||
-rw-r--r-- | node_modules/colors/package.json | 12 |
7 files changed, 80 insertions, 11 deletions
diff --git a/node_modules/colors/README.md b/node_modules/colors/README.md index 4bebb6c92..fabe55890 100644 --- a/node_modules/colors/README.md +++ b/node_modules/colors/README.md @@ -29,6 +29,16 @@ Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. - gray - grey +### bright text colors + + - brightRed + - brightGreen + - brightYellow + - brightBlue + - brightMagenta + - brightCyan + - brightWhite + ### background colors - bgBlack @@ -39,6 +49,18 @@ Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. - bgMagenta - bgCyan - bgWhite + - bgGray + - bgGrey + +### bright background colors + + - bgBrightRed + - bgBrightGreen + - bgBrightYellow + - bgBrightBlue + - bgBrightMagenta + - bgBrightCyan + - bgBrightWhite ### styles @@ -94,12 +116,27 @@ I prefer the first way. Some people seem to be afraid of extending `String.proto If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object. -## Disabling Colors +## Enabling/Disabling Colors -To disable colors you can pass the following arguments in the command line to your application: +The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag: ```bash node myapp.js --no-color +node myapp.js --color=false + +node myapp.js --color +node myapp.js --color=true +node myapp.js --color=always + +FORCE_COLOR=1 node myapp.js +``` + +Or in code: + +```javascript +var colors = require('colors'); +colors.enable(); +colors.disable(); ``` ## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data) diff --git a/node_modules/colors/examples/normal-usage.js b/node_modules/colors/examples/normal-usage.js index cc8d05ff4..822db1cc8 100644 --- a/node_modules/colors/examples/normal-usage.js +++ b/node_modules/colors/examples/normal-usage.js @@ -29,6 +29,7 @@ console.log('Background color attack!'.black.bgWhite); console.log('Use random styles on everything!'.random); console.log('America, Heck Yeah!'.america); +console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen); console.log('Setting themes is useful'); diff --git a/node_modules/colors/examples/safe-string.js b/node_modules/colors/examples/safe-string.js index 989948735..5bc0168e3 100644 --- a/node_modules/colors/examples/safe-string.js +++ b/node_modules/colors/examples/safe-string.js @@ -28,6 +28,8 @@ console.log(colors.black.bgWhite('Background color attack!')); console.log(colors.random('Use random styles on everything!')); console.log(colors.america('America, Heck Yeah!')); +console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!')); + console.log('Setting themes is useful'); // diff --git a/node_modules/colors/lib/colors.js b/node_modules/colors/lib/colors.js index 7ca90fa90..9c7f1d141 100644 --- a/node_modules/colors/lib/colors.js +++ b/node_modules/colors/lib/colors.js @@ -62,7 +62,16 @@ var stylize = colors.stylize = function stylize(str, style) { return str+''; } - return ansiStyles[style].open + str + ansiStyles[style].close; + var styleMap = ansiStyles[style]; + + // Stylize should work for non-ANSI styles, too + if(!styleMap && style in colors){ + // Style maps like trap operate as functions on strings; + // they don't have properties like open or close. + return colors[style](str); + } + + return styleMap.open + str + styleMap.close; }; var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; @@ -105,7 +114,8 @@ function applyStyle() { var args = Array.prototype.slice.call(arguments); var str = args.map(function(arg) { - if (arg !== undefined && arg.constructor === String) { + // Use weak equality check so we can colorize null/undefined in safe mode + if (arg != null && arg.constructor === String) { return arg; } else { return util.inspect(arg); diff --git a/node_modules/colors/lib/maps/random.js b/node_modules/colors/lib/maps/random.js index 6f8f2f8e1..3d82a39ec 100644 --- a/node_modules/colors/lib/maps/random.js +++ b/node_modules/colors/lib/maps/random.js @@ -1,6 +1,7 @@ module['exports'] = function(colors) { var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', - 'blue', 'white', 'cyan', 'magenta']; + 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed', + 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta']; return function(letter, i, exploded) { return letter === ' ' ? letter : colors[ diff --git a/node_modules/colors/lib/styles.js b/node_modules/colors/lib/styles.js index 02db9acf7..011dafd8c 100644 --- a/node_modules/colors/lib/styles.js +++ b/node_modules/colors/lib/styles.js @@ -48,6 +48,14 @@ var codes = { gray: [90, 39], grey: [90, 39], + brightRed: [91, 39], + brightGreen: [92, 39], + brightYellow: [93, 39], + brightBlue: [94, 39], + brightMagenta: [95, 39], + brightCyan: [96, 39], + brightWhite: [97, 39], + bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], @@ -56,6 +64,16 @@ var codes = { bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], + bgGray: [100, 49], + bgGrey: [100, 49], + + bgBrightRed: [101, 49], + bgBrightGreen: [102, 49], + bgBrightYellow: [103, 49], + bgBrightBlue: [104, 49], + bgBrightMagenta: [105, 49], + bgBrightCyan: [106, 49], + bgBrightWhite: [107, 49], // legacy styles for colors pre v1.0.0 blackBG: [40, 49], diff --git a/node_modules/colors/package.json b/node_modules/colors/package.json index 712ab466d..0a6c4135a 100644 --- a/node_modules/colors/package.json +++ b/node_modules/colors/package.json @@ -1,8 +1,8 @@ { "_from": "colors@^1.1.2", - "_id": "colors@1.3.3", + "_id": "colors@1.4.0", "_inBundle": false, - "_integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==", + "_integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", "_location": "/colors", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/cli-table3" ], - "_resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz", - "_shasum": "39e005d546afe01e01f9c4ca8fa50f686a01205d", + "_resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "_shasum": "c50491479d4c1bdaed2c9ced32cf7c7dc2360f78", "_spec": "colors@^1.1.2", - "_where": "/Users/aeschright/code/cli/node_modules/cli-table3", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/cli-table3", "author": { "name": "Marak Squires" }, @@ -70,5 +70,5 @@ "lint": "eslint . --fix", "test": "node tests/basic-test.js && node tests/safe-test.js" }, - "version": "1.3.3" + "version": "1.4.0" } |