update dependencies
This commit is contained in:
parent
3d7b804c59
commit
79678ca6dd
10 changed files with 161 additions and 659 deletions
22
node_modules/colors/MIT-LICENSE.txt
generated
vendored
22
node_modules/colors/MIT-LICENSE.txt
generated
vendored
|
@ -1,22 +0,0 @@
|
|||
Copyright (c) 2010
|
||||
|
||||
Marak Squires
|
||||
Alexis Sellier (cloudhead)
|
||||
|
||||
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.
|
161
node_modules/colors/ReadMe.md
generated
vendored
161
node_modules/colors/ReadMe.md
generated
vendored
|
@ -1,7 +1,8 @@
|
|||
# colors.js - get color and style in your node.js console ( and browser ) like what
|
||||
# colors.js [![Build Status](https://travis-ci.org/Marak/colors.js.svg?branch=master)](https://travis-ci.org/Marak/colors.js)
|
||||
|
||||
<img src="http://i.imgur.com/goJdO.png" border = "0"/>
|
||||
## get color and style in your node.js console
|
||||
|
||||
![Demo](https://raw.githubusercontent.com/Marak/colors.js/master/screenshots/colors.png)
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -9,34 +10,103 @@
|
|||
|
||||
## colors and styles!
|
||||
|
||||
- bold
|
||||
- italic
|
||||
- underline
|
||||
- inverse
|
||||
- yellow
|
||||
- cyan
|
||||
- white
|
||||
- magenta
|
||||
- green
|
||||
- red
|
||||
- grey
|
||||
- blue
|
||||
- rainbow
|
||||
- zebra
|
||||
- random
|
||||
### text colors
|
||||
|
||||
- black
|
||||
- red
|
||||
- green
|
||||
- yellow
|
||||
- blue
|
||||
- magenta
|
||||
- cyan
|
||||
- white
|
||||
- gray
|
||||
- grey
|
||||
|
||||
### background colors
|
||||
|
||||
- bgBlack
|
||||
- bgRed
|
||||
- bgGreen
|
||||
- bgYellow
|
||||
- bgBlue
|
||||
- bgMagenta
|
||||
- bgCyan
|
||||
- bgWhite
|
||||
|
||||
### styles
|
||||
|
||||
- reset
|
||||
- bold
|
||||
- dim
|
||||
- italic
|
||||
- underline
|
||||
- inverse
|
||||
- hidden
|
||||
- strikethrough
|
||||
|
||||
### extras
|
||||
|
||||
- rainbow
|
||||
- zebra
|
||||
- america
|
||||
- trap
|
||||
- random
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
var colors = require('./colors');
|
||||
By popular demand, `colors` now ships with two types of usages!
|
||||
|
||||
The super nifty way
|
||||
|
||||
```js
|
||||
var colors = require('colors');
|
||||
|
||||
console.log('hello'.green); // outputs green text
|
||||
console.log('i like cake and pies'.underline.red) // outputs red underlined text
|
||||
console.log('inverse the color'.inverse); // inverses the color
|
||||
console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)
|
||||
console.log('OMG Rainbows!'.rainbow); // rainbow
|
||||
console.log('Run the trap'.trap); // Drops the bass
|
||||
|
||||
```
|
||||
|
||||
# Creating Custom themes
|
||||
or a slightly less nifty way which doesn't extend `String.prototype`
|
||||
|
||||
```js
|
||||
var colors = require('colors/safe');
|
||||
|
||||
console.log(colors.green('hello')); // outputs green text
|
||||
console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text
|
||||
console.log(colors.inverse('inverse the color')); // inverses the color
|
||||
console.log(colors.rainbow('OMG Rainbows!')); // rainbow
|
||||
console.log(colors.trap('Run the trap')); // Drops the bass
|
||||
|
||||
```
|
||||
|
||||
I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
|
||||
|
||||
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
|
||||
|
||||
To disable colors you can pass the following arguments in the command line to your application:
|
||||
|
||||
```bash
|
||||
node myapp.js --no-color
|
||||
```
|
||||
|
||||
## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
|
||||
|
||||
```js
|
||||
var name = 'Marak';
|
||||
console.log(colors.green('Hello %s'), name);
|
||||
// outputs -> 'Hello Marak'
|
||||
```
|
||||
|
||||
## Custom themes
|
||||
|
||||
### Using standard API
|
||||
|
||||
```js
|
||||
|
||||
|
@ -62,16 +132,47 @@ console.log("this is an error".error);
|
|||
console.log("this is a warning".warn);
|
||||
```
|
||||
|
||||
### Using string safe API
|
||||
|
||||
### Contributors
|
||||
```js
|
||||
var colors = require('colors/safe');
|
||||
|
||||
Marak (Marak Squires)
|
||||
Alexis Sellier (cloudhead)
|
||||
mmalecki (Maciej Małecki)
|
||||
nicoreed (Nico Reed)
|
||||
morganrallen (Morgan Allen)
|
||||
JustinCampbell (Justin Campbell)
|
||||
ded (Dustin Diaz)
|
||||
// set single property
|
||||
var error = colors.red;
|
||||
error('this is red');
|
||||
|
||||
// set theme
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded)
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
|
||||
```
|
||||
|
||||
You can also combine them:
|
||||
|
||||
```javascript
|
||||
var colors = require('colors');
|
||||
|
||||
colors.setTheme({
|
||||
custom: ['red', 'underline']
|
||||
});
|
||||
|
||||
console.log('test'.custom);
|
||||
```
|
||||
|
||||
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
|
||||
|
|
342
node_modules/colors/colors.js
generated
vendored
342
node_modules/colors/colors.js
generated
vendored
|
@ -1,342 +0,0 @@
|
|||
/*
|
||||
colors.js
|
||||
|
||||
Copyright (c) 2010
|
||||
|
||||
Marak Squires
|
||||
Alexis Sellier (cloudhead)
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
var isHeadless = false;
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
isHeadless = true;
|
||||
}
|
||||
|
||||
if (!isHeadless) {
|
||||
var exports = {};
|
||||
var module = {};
|
||||
var colors = exports;
|
||||
exports.mode = "browser";
|
||||
} else {
|
||||
exports.mode = "console";
|
||||
}
|
||||
|
||||
//
|
||||
// Prototypes the string object to have additional method calls that add terminal colors
|
||||
//
|
||||
var addProperty = function (color, func) {
|
||||
exports[color] = function (str) {
|
||||
return func.apply(str);
|
||||
};
|
||||
String.prototype.__defineGetter__(color, func);
|
||||
};
|
||||
|
||||
function stylize(str, style) {
|
||||
|
||||
var styles;
|
||||
|
||||
if (exports.mode === 'console') {
|
||||
styles = {
|
||||
//styles
|
||||
'bold' : ['\x1B[1m', '\x1B[22m'],
|
||||
'italic' : ['\x1B[3m', '\x1B[23m'],
|
||||
'underline' : ['\x1B[4m', '\x1B[24m'],
|
||||
'inverse' : ['\x1B[7m', '\x1B[27m'],
|
||||
'strikethrough' : ['\x1B[9m', '\x1B[29m'],
|
||||
//text colors
|
||||
//grayscale
|
||||
'white' : ['\x1B[37m', '\x1B[39m'],
|
||||
'grey' : ['\x1B[90m', '\x1B[39m'],
|
||||
'black' : ['\x1B[30m', '\x1B[39m'],
|
||||
//colors
|
||||
'blue' : ['\x1B[34m', '\x1B[39m'],
|
||||
'cyan' : ['\x1B[36m', '\x1B[39m'],
|
||||
'green' : ['\x1B[32m', '\x1B[39m'],
|
||||
'magenta' : ['\x1B[35m', '\x1B[39m'],
|
||||
'red' : ['\x1B[31m', '\x1B[39m'],
|
||||
'yellow' : ['\x1B[33m', '\x1B[39m'],
|
||||
//background colors
|
||||
//grayscale
|
||||
'whiteBG' : ['\x1B[47m', '\x1B[49m'],
|
||||
'greyBG' : ['\x1B[49;5;8m', '\x1B[49m'],
|
||||
'blackBG' : ['\x1B[40m', '\x1B[49m'],
|
||||
//colors
|
||||
'blueBG' : ['\x1B[44m', '\x1B[49m'],
|
||||
'cyanBG' : ['\x1B[46m', '\x1B[49m'],
|
||||
'greenBG' : ['\x1B[42m', '\x1B[49m'],
|
||||
'magentaBG' : ['\x1B[45m', '\x1B[49m'],
|
||||
'redBG' : ['\x1B[41m', '\x1B[49m'],
|
||||
'yellowBG' : ['\x1B[43m', '\x1B[49m']
|
||||
};
|
||||
} else if (exports.mode === 'browser') {
|
||||
styles = {
|
||||
//styles
|
||||
'bold' : ['<b>', '</b>'],
|
||||
'italic' : ['<i>', '</i>'],
|
||||
'underline' : ['<u>', '</u>'],
|
||||
'inverse' : ['<span style="background-color:black;color:white;">', '</span>'],
|
||||
'strikethrough' : ['<del>', '</del>'],
|
||||
//text colors
|
||||
//grayscale
|
||||
'white' : ['<span style="color:white;">', '</span>'],
|
||||
'grey' : ['<span style="color:gray;">', '</span>'],
|
||||
'black' : ['<span style="color:black;">', '</span>'],
|
||||
//colors
|
||||
'blue' : ['<span style="color:blue;">', '</span>'],
|
||||
'cyan' : ['<span style="color:cyan;">', '</span>'],
|
||||
'green' : ['<span style="color:green;">', '</span>'],
|
||||
'magenta' : ['<span style="color:magenta;">', '</span>'],
|
||||
'red' : ['<span style="color:red;">', '</span>'],
|
||||
'yellow' : ['<span style="color:yellow;">', '</span>'],
|
||||
//background colors
|
||||
//grayscale
|
||||
'whiteBG' : ['<span style="background-color:white;">', '</span>'],
|
||||
'greyBG' : ['<span style="background-color:gray;">', '</span>'],
|
||||
'blackBG' : ['<span style="background-color:black;">', '</span>'],
|
||||
//colors
|
||||
'blueBG' : ['<span style="background-color:blue;">', '</span>'],
|
||||
'cyanBG' : ['<span style="background-color:cyan;">', '</span>'],
|
||||
'greenBG' : ['<span style="background-color:green;">', '</span>'],
|
||||
'magentaBG' : ['<span style="background-color:magenta;">', '</span>'],
|
||||
'redBG' : ['<span style="background-color:red;">', '</span>'],
|
||||
'yellowBG' : ['<span style="background-color:yellow;">', '</span>']
|
||||
};
|
||||
} else if (exports.mode === 'none') {
|
||||
return str + '';
|
||||
} else {
|
||||
console.log('unsupported mode, try "browser", "console" or "none"');
|
||||
}
|
||||
return styles[style][0] + str + styles[style][1];
|
||||
}
|
||||
|
||||
function applyTheme(theme) {
|
||||
|
||||
//
|
||||
// Remark: This is a list of methods that exist
|
||||
// on String that you should not overwrite.
|
||||
//
|
||||
var stringPrototypeBlacklist = [
|
||||
'__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'charAt', 'constructor',
|
||||
'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf', 'charCodeAt',
|
||||
'indexOf', 'lastIndexof', 'length', 'localeCompare', 'match', 'replace', 'search', 'slice', 'split', 'substring',
|
||||
'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight'
|
||||
];
|
||||
|
||||
Object.keys(theme).forEach(function (prop) {
|
||||
if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
|
||||
console.log('warn: '.red + ('String.prototype' + prop).magenta + ' is probably something you don\'t want to override. Ignoring style name');
|
||||
}
|
||||
else {
|
||||
if (typeof(theme[prop]) === 'string') {
|
||||
addProperty(prop, function () {
|
||||
return exports[theme[prop]](this);
|
||||
});
|
||||
}
|
||||
else {
|
||||
addProperty(prop, function () {
|
||||
var ret = this;
|
||||
for (var t = 0; t < theme[prop].length; t++) {
|
||||
ret = exports[theme[prop][t]](ret);
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Iterate through all default styles and colors
|
||||
//
|
||||
var x = ['bold', 'underline', 'strikethrough', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta', 'greyBG', 'blackBG', 'yellowBG', 'redBG', 'greenBG', 'blueBG', 'whiteBG', 'cyanBG', 'magentaBG'];
|
||||
x.forEach(function (style) {
|
||||
|
||||
// __defineGetter__ at the least works in more browsers
|
||||
// http://robertnyman.com/javascript/javascript-getters-setters.html
|
||||
// Object.defineProperty only works in Chrome
|
||||
addProperty(style, function () {
|
||||
return stylize(this, style);
|
||||
});
|
||||
});
|
||||
|
||||
function sequencer(map) {
|
||||
return function () {
|
||||
if (!isHeadless) {
|
||||
return this.replace(/( )/, '$1');
|
||||
}
|
||||
var exploded = this.split(""), i = 0;
|
||||
exploded = exploded.map(map);
|
||||
return exploded.join("");
|
||||
};
|
||||
}
|
||||
|
||||
var rainbowMap = (function () {
|
||||
var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; //RoY G BiV
|
||||
return function (letter, i, exploded) {
|
||||
if (letter === " ") {
|
||||
return letter;
|
||||
} else {
|
||||
return stylize(letter, rainbowColors[i++ % rainbowColors.length]);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
exports.themes = {};
|
||||
|
||||
exports.addSequencer = function (name, map) {
|
||||
addProperty(name, sequencer(map));
|
||||
};
|
||||
|
||||
exports.addSequencer('rainbow', rainbowMap);
|
||||
exports.addSequencer('zebra', function (letter, i, exploded) {
|
||||
return i % 2 === 0 ? letter : letter.inverse;
|
||||
});
|
||||
|
||||
exports.setTheme = function (theme) {
|
||||
if (typeof theme === 'string') {
|
||||
try {
|
||||
exports.themes[theme] = require(theme);
|
||||
applyTheme(exports.themes[theme]);
|
||||
return exports.themes[theme];
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
applyTheme(theme);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
addProperty('stripColors', function () {
|
||||
return ("" + this).replace(/\x1B\[\d+m/g, '');
|
||||
});
|
||||
|
||||
// please no
|
||||
function zalgo(text, options) {
|
||||
var soul = {
|
||||
"up" : [
|
||||
'̍', '̎', '̄', '̅',
|
||||
'̿', '̑', '̆', '̐',
|
||||
'͒', '͗', '͑', '̇',
|
||||
'̈', '̊', '͂', '̓',
|
||||
'̈', '͊', '͋', '͌',
|
||||
'̃', '̂', '̌', '͐',
|
||||
'̀', '́', '̋', '̏',
|
||||
'̒', '̓', '̔', '̽',
|
||||
'̉', 'ͣ', 'ͤ', 'ͥ',
|
||||
'ͦ', 'ͧ', 'ͨ', 'ͩ',
|
||||
'ͪ', 'ͫ', 'ͬ', 'ͭ',
|
||||
'ͮ', 'ͯ', '̾', '͛',
|
||||
'͆', '̚'
|
||||
],
|
||||
"down" : [
|
||||
'̖', '̗', '̘', '̙',
|
||||
'̜', '̝', '̞', '̟',
|
||||
'̠', '̤', '̥', '̦',
|
||||
'̩', '̪', '̫', '̬',
|
||||
'̭', '̮', '̯', '̰',
|
||||
'̱', '̲', '̳', '̹',
|
||||
'̺', '̻', '̼', 'ͅ',
|
||||
'͇', '͈', '͉', '͍',
|
||||
'͎', '͓', '͔', '͕',
|
||||
'͖', '͙', '͚', '̣'
|
||||
],
|
||||
"mid" : [
|
||||
'̕', '̛', '̀', '́',
|
||||
'͘', '̡', '̢', '̧',
|
||||
'̨', '̴', '̵', '̶',
|
||||
'͜', '͝', '͞',
|
||||
'͟', '͠', '͢', '̸',
|
||||
'̷', '͡', ' ҉'
|
||||
]
|
||||
},
|
||||
all = [].concat(soul.up, soul.down, soul.mid),
|
||||
zalgo = {};
|
||||
|
||||
function randomNumber(range) {
|
||||
var r = Math.floor(Math.random() * range);
|
||||
return r;
|
||||
}
|
||||
|
||||
function is_char(character) {
|
||||
var bool = false;
|
||||
all.filter(function (i) {
|
||||
bool = (i === character);
|
||||
});
|
||||
return bool;
|
||||
}
|
||||
|
||||
function heComes(text, options) {
|
||||
var result = '', counts, l;
|
||||
options = options || {};
|
||||
options["up"] = options["up"] || true;
|
||||
options["mid"] = options["mid"] || true;
|
||||
options["down"] = options["down"] || true;
|
||||
options["size"] = options["size"] || "maxi";
|
||||
text = text.split('');
|
||||
for (l in text) {
|
||||
if (is_char(l)) {
|
||||
continue;
|
||||
}
|
||||
result = result + text[l];
|
||||
counts = {"up" : 0, "down" : 0, "mid" : 0};
|
||||
switch (options.size) {
|
||||
case 'mini':
|
||||
counts.up = randomNumber(8);
|
||||
counts.min = randomNumber(2);
|
||||
counts.down = randomNumber(8);
|
||||
break;
|
||||
case 'maxi':
|
||||
counts.up = randomNumber(16) + 3;
|
||||
counts.min = randomNumber(4) + 1;
|
||||
counts.down = randomNumber(64) + 3;
|
||||
break;
|
||||
default:
|
||||
counts.up = randomNumber(8) + 1;
|
||||
counts.mid = randomNumber(6) / 2;
|
||||
counts.down = randomNumber(8) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
var arr = ["up", "mid", "down"];
|
||||
for (var d in arr) {
|
||||
var index = arr[d];
|
||||
for (var i = 0 ; i <= counts[index]; i++) {
|
||||
if (options[index]) {
|
||||
result = result + soul[index][randomNumber(soul[index].length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return heComes(text);
|
||||
}
|
||||
|
||||
|
||||
// don't summon zalgo
|
||||
addProperty('zalgo', function () {
|
||||
return zalgo(this);
|
||||
});
|
76
node_modules/colors/example.html
generated
vendored
76
node_modules/colors/example.html
generated
vendored
|
@ -1,76 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Colors Example</title>
|
||||
<script src="colors.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
var test = colors.red("hopefully colorless output");
|
||||
|
||||
document.write('Rainbows are fun!'.rainbow + '<br/>');
|
||||
document.write('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
|
||||
document.write('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
||||
//document.write('zalgo time!'.zalgo);
|
||||
document.write(test.stripColors);
|
||||
document.write("a".grey + " b".black);
|
||||
|
||||
document.write("Zebras are so fun!".zebra);
|
||||
|
||||
document.write(colors.rainbow('Rainbows are fun!'));
|
||||
document.write("This is " + "not".strikethrough + " fun.");
|
||||
|
||||
document.write(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported
|
||||
document.write(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported
|
||||
//document.write(colors.zalgo('zalgo time!'));
|
||||
document.write(colors.stripColors(test));
|
||||
document.write(colors.grey("a") + colors.black(" b"));
|
||||
|
||||
colors.addSequencer("america", function(letter, i, exploded) {
|
||||
if(letter === " ") return letter;
|
||||
switch(i%3) {
|
||||
case 0: return letter.red;
|
||||
case 1: return letter.white;
|
||||
case 2: return letter.blue;
|
||||
}
|
||||
});
|
||||
|
||||
colors.addSequencer("random", (function() {
|
||||
var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'];
|
||||
|
||||
return function(letter, i, exploded) {
|
||||
return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]];
|
||||
};
|
||||
})());
|
||||
|
||||
document.write("AMERICA! F--K YEAH!".america);
|
||||
document.write("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random);
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
document.write("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
document.write("this is a warning".warn);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
77
node_modules/colors/example.js
generated
vendored
77
node_modules/colors/example.js
generated
vendored
|
@ -1,77 +0,0 @@
|
|||
var colors = require('./colors');
|
||||
|
||||
//colors.mode = "browser";
|
||||
|
||||
var test = colors.red("hopefully colorless output");
|
||||
console.log('Rainbows are fun!'.rainbow);
|
||||
console.log('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
|
||||
console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
||||
//console.log('zalgo time!'.zalgo);
|
||||
console.log(test.stripColors);
|
||||
console.log("a".grey + " b".black);
|
||||
console.log("Zebras are so fun!".zebra);
|
||||
console.log('background color attack!'.black.whiteBG)
|
||||
|
||||
//
|
||||
// Remark: .strikethrough may not work with Mac OS Terminal App
|
||||
//
|
||||
console.log("This is " + "not".strikethrough + " fun.");
|
||||
console.log(colors.rainbow('Rainbows are fun!'));
|
||||
console.log(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported
|
||||
console.log(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported
|
||||
//console.log(colors.zalgo('zalgo time!'));
|
||||
console.log(colors.stripColors(test));
|
||||
console.log(colors.grey("a") + colors.black(" b"));
|
||||
|
||||
colors.addSequencer("america", function(letter, i, exploded) {
|
||||
if(letter === " ") return letter;
|
||||
switch(i%3) {
|
||||
case 0: return letter.red;
|
||||
case 1: return letter.white;
|
||||
case 2: return letter.blue;
|
||||
}
|
||||
});
|
||||
|
||||
colors.addSequencer("random", (function() {
|
||||
var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'];
|
||||
|
||||
return function(letter, i, exploded) {
|
||||
return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]];
|
||||
};
|
||||
})());
|
||||
|
||||
console.log("AMERICA! F--K YEAH!".america);
|
||||
console.log("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random);
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
|
||||
// Load theme with JSON literal
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
|
||||
// outputs grey text
|
||||
console.log("this is an input".input);
|
||||
|
||||
// Load a theme from file
|
||||
colors.setTheme('./themes/winston-dark.js');
|
||||
|
||||
console.log("this is an input".input);
|
||||
|
40
node_modules/colors/package.json
generated
vendored
40
node_modules/colors/package.json
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "colors",
|
||||
"description": "get colors in your node.js console like what",
|
||||
"version": "0.6.2",
|
||||
"description": "get colors in your node.js console",
|
||||
"version": "1.1.2",
|
||||
"author": {
|
||||
"name": "Marak Squires"
|
||||
},
|
||||
|
@ -18,17 +18,27 @@
|
|||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/Marak/colors.js.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "node tests/basic-test.js && node tests/safe-test.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.1.90"
|
||||
},
|
||||
"main": "colors",
|
||||
"_id": "colors@0.6.2",
|
||||
"dist": {
|
||||
"shasum": "2423fe6678ac0c5dae8852e5d0e5be08c997abcc",
|
||||
"tarball": "http://registry.npmjs.org/colors/-/colors-0.6.2.tgz"
|
||||
},
|
||||
"_from": "colors@>=0.6.2 <0.7.0",
|
||||
"_npmVersion": "1.2.30",
|
||||
"main": "lib",
|
||||
"files": [
|
||||
"examples",
|
||||
"lib",
|
||||
"LICENSE",
|
||||
"safe.js",
|
||||
"themes"
|
||||
],
|
||||
"gitHead": "8bf2ad9fa695dcb30b7e9fd83691b139fd6655c4",
|
||||
"_id": "colors@1.1.2",
|
||||
"_shasum": "168a4701756b6a7f51a12ce0c97bfa28c084ed63",
|
||||
"_from": "colors@1.1.2",
|
||||
"_npmVersion": "2.1.8",
|
||||
"_nodeVersion": "0.11.13",
|
||||
"_npmUser": {
|
||||
"name": "marak",
|
||||
"email": "marak.squires@gmail.com"
|
||||
|
@ -39,9 +49,11 @@
|
|||
"email": "marak.squires@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "168a4701756b6a7f51a12ce0c97bfa28c084ed63",
|
||||
"tarball": "http://registry.npmjs.org/colors/-/colors-1.1.2.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_shasum": "2423fe6678ac0c5dae8852e5d0e5be08c997abcc",
|
||||
"_resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz",
|
||||
"readme": "ERROR: No README data found!",
|
||||
"scripts": {}
|
||||
"_resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
|
|
70
node_modules/colors/test.js
generated
vendored
70
node_modules/colors/test.js
generated
vendored
|
@ -1,70 +0,0 @@
|
|||
var assert = require('assert'),
|
||||
colors = require('./colors');
|
||||
|
||||
var s = 'string';
|
||||
|
||||
function a(s, code) {
|
||||
return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m';
|
||||
}
|
||||
|
||||
function aE(s, color, code) {
|
||||
assert.equal(s[color], a(s, code));
|
||||
assert.equal(colors[color](s), a(s, code));
|
||||
assert.equal(s[color], colors[color](s));
|
||||
assert.equal(s[color].stripColors, s);
|
||||
assert.equal(s[color].stripColors, colors.stripColors(s));
|
||||
}
|
||||
|
||||
function h(s, color) {
|
||||
return '<span style="color:' + color + ';">' + s + '</span>';
|
||||
}
|
||||
|
||||
var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'];
|
||||
var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']);
|
||||
|
||||
colors.mode = 'console';
|
||||
assert.equal(s.bold, '\x1B[1m' + s + '\x1B[22m');
|
||||
assert.equal(s.italic, '\x1B[3m' + s + '\x1B[23m');
|
||||
assert.equal(s.underline, '\x1B[4m' + s + '\x1B[24m');
|
||||
assert.equal(s.strikethrough, '\x1B[9m' + s + '\x1B[29m');
|
||||
assert.equal(s.inverse, '\x1B[7m' + s + '\x1B[27m');
|
||||
assert.ok(s.rainbow);
|
||||
aE(s, 'white', 37);
|
||||
aE(s, 'grey', 90);
|
||||
aE(s, 'black', 30);
|
||||
aE(s, 'blue', 34);
|
||||
aE(s, 'cyan', 36);
|
||||
aE(s, 'green', 32);
|
||||
aE(s, 'magenta', 35);
|
||||
aE(s, 'red', 31);
|
||||
aE(s, 'yellow', 33);
|
||||
assert.equal(s, 'string');
|
||||
|
||||
colors.setTheme({error:'red'});
|
||||
|
||||
assert.equal(typeof("astring".red),'string');
|
||||
assert.equal(typeof("astring".error),'string');
|
||||
|
||||
colors.mode = 'browser';
|
||||
assert.equal(s.bold, '<b>' + s + '</b>');
|
||||
assert.equal(s.italic, '<i>' + s + '</i>');
|
||||
assert.equal(s.underline, '<u>' + s + '</u>');
|
||||
assert.equal(s.strikethrough, '<del>' + s + '</del>');
|
||||
assert.equal(s.inverse, '<span style="background-color:black;color:white;">' + s + '</span>');
|
||||
assert.ok(s.rainbow);
|
||||
stylesColors.forEach(function (color) {
|
||||
assert.equal(s[color], h(s, color));
|
||||
assert.equal(colors[color](s), h(s, color));
|
||||
});
|
||||
|
||||
assert.equal(typeof("astring".red),'string');
|
||||
assert.equal(typeof("astring".error),'string');
|
||||
|
||||
colors.mode = 'none';
|
||||
stylesAll.forEach(function (style) {
|
||||
assert.equal(s[style], s);
|
||||
assert.equal(colors[style](s), s);
|
||||
});
|
||||
|
||||
assert.equal(typeof("astring".red),'string');
|
||||
assert.equal(typeof("astring".error),'string');
|
12
node_modules/colors/themes/winston-dark.js
generated
vendored
12
node_modules/colors/themes/winston-dark.js
generated
vendored
|
@ -1,12 +0,0 @@
|
|||
module['exports'] = {
|
||||
silly: 'rainbow',
|
||||
input: 'black',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
};
|
12
node_modules/colors/themes/winston-light.js
generated
vendored
12
node_modules/colors/themes/winston-light.js
generated
vendored
|
@ -1,12 +0,0 @@
|
|||
module['exports'] = {
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
};
|
|
@ -7,10 +7,10 @@
|
|||
"example": "example"
|
||||
},
|
||||
"dependencies": {
|
||||
"colors": "~0.6.2",
|
||||
"event-pubsub": "~1.0.3",
|
||||
"js-message": "*",
|
||||
"node-cmd": "~1.0.1"
|
||||
"colors": "^1.1.2",
|
||||
"event-pubsub": "^1.0.3",
|
||||
"js-message": "^1.0.5",
|
||||
"node-cmd": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in a new issue