mirror of
https://github.com/flynx/colors.js.git
synced 2025-10-29 11:00:11 +00:00
[dist] Updated package.json, bumped version, added creds. [misc] Snuck in demonic entity.
This commit is contained in:
parent
97338e78c4
commit
4b6bc29521
@ -27,4 +27,4 @@
|
|||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
|
|
||||||
#### Alexis Sellier (cloudhead) , Marak Squires , Justin Campbell
|
#### Alexis Sellier (cloudhead) , Marak Squires , Justin Campbell, Dustin Diaz (@ded)
|
||||||
|
|||||||
111
colors.js
111
colors.js
@ -79,4 +79,113 @@ function stylize(str, style) {
|
|||||||
};
|
};
|
||||||
return '\033[' + styles[style][0] + 'm' + str +
|
return '\033[' + styles[style][0] + 'm' + str +
|
||||||
'\033[' + styles[style][1] + 'm';
|
'\033[' + styles[style][1] + 'm';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// don't summon zalgo
|
||||||
|
String.prototype.__defineGetter__('zalgo', function () {
|
||||||
|
return zalgo(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
// please no
|
||||||
|
function zalgo(text, options) {
|
||||||
|
var soul = {
|
||||||
|
"up" : [
|
||||||
|
'̍','̎','̄','̅',
|
||||||
|
'̿','̑','̆','̐',
|
||||||
|
'͒','͗','͑','̇',
|
||||||
|
'̈','̊','͂','̓',
|
||||||
|
'̈','͊','͋','͌',
|
||||||
|
'̃','̂','̌','͐',
|
||||||
|
'̀','́','̋','̏',
|
||||||
|
'̒','̓','̔','̽',
|
||||||
|
'̉','ͣ','ͤ','ͥ',
|
||||||
|
'ͦ','ͧ','ͨ','ͩ',
|
||||||
|
'ͪ','ͫ','ͬ','ͭ',
|
||||||
|
'ͮ','ͯ','̾','͛',
|
||||||
|
'͆','̚'
|
||||||
|
],
|
||||||
|
"down" : [
|
||||||
|
'̖','̗','̘','̙',
|
||||||
|
'̜','̝','̞','̟',
|
||||||
|
'̠','̤','̥','̦',
|
||||||
|
'̩','̪','̫','̬',
|
||||||
|
'̭','̮','̯','̰',
|
||||||
|
'̱','̲','̳','̹',
|
||||||
|
'̺','̻','̼','ͅ',
|
||||||
|
'͇','͈','͉','͍',
|
||||||
|
'͎','͓','͔','͕',
|
||||||
|
'͖','͙','͚','̣'
|
||||||
|
],
|
||||||
|
"mid" : [
|
||||||
|
'̕','̛','̀','́',
|
||||||
|
'͘','̡','̢','̧',
|
||||||
|
'̨','̴','̵','̶',
|
||||||
|
'͜','͝','͞',
|
||||||
|
'͟','͠','͢','̸',
|
||||||
|
'̷','͡',' ҉'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
all = [].concat(soul.up, soul.down, soul.mid),
|
||||||
|
zalgo = {};
|
||||||
|
|
||||||
|
function randomNumber(range) {
|
||||||
|
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){
|
||||||
|
result = '';
|
||||||
|
options = options || {};
|
||||||
|
options["up"] = options["up"] || true;
|
||||||
|
options["mid"] = options["mid"] || true;
|
||||||
|
options["down"] = options["down"] || true;
|
||||||
|
options["size"] = options["size"] || "maxi";
|
||||||
|
var counts;
|
||||||
|
text = text.split('');
|
||||||
|
for(var 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);
|
||||||
|
}
|
||||||
|
|||||||
@ -3,4 +3,5 @@ var colors = require('./colors');
|
|||||||
|
|
||||||
sys.puts('Rainbows are fun!'.rainbow);
|
sys.puts('Rainbows are fun!'.rainbow);
|
||||||
sys.puts('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
|
sys.puts('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
|
||||||
sys.puts('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
sys.puts('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
||||||
|
// sys.puts('zalgo time!'.zalgo);
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "colors",
|
"name": "colors",
|
||||||
"description": "get colors in your node.js console like what",
|
"description": "get colors in your node.js console like what",
|
||||||
"version": "0.4.1",
|
"version": "0.5.0",
|
||||||
"author": "Marak Squires",
|
"author": "Marak Squires",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -10,5 +10,5 @@
|
|||||||
"engine": [
|
"engine": [
|
||||||
"node >=0.1.90"
|
"node >=0.1.90"
|
||||||
],
|
],
|
||||||
"main": "colors.js"
|
"main": "colors"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user