Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/colors/lib')
-rw-r--r--node_modules/colors/lib/colors.js14
-rw-r--r--node_modules/colors/lib/maps/random.js3
-rw-r--r--node_modules/colors/lib/styles.js18
3 files changed, 32 insertions, 3 deletions
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],