Comparing version 1.0.3 to 1.1.0
@@ -51,2 +51,6 @@ /* | ||
var stylize = colors.stylize = function stylize (str, style) { | ||
if (!colors.enabled) { | ||
return str+''; | ||
} | ||
return ansiStyles[style].open + str + ansiStyles[style].close; | ||
@@ -119,2 +123,9 @@ } | ||
colors[style] = function(str){ | ||
if (typeof theme[style] === 'object'){ | ||
var out = str; | ||
for (var i in theme[style]){ | ||
out = colors[theme[style][i]](out); | ||
} | ||
return out; | ||
} | ||
return colors[theme[style]](str); | ||
@@ -121,0 +132,0 @@ }; |
@@ -61,6 +61,6 @@ // please no | ||
options = options || {}; | ||
options["up"] = options["up"] || true; | ||
options["mid"] = options["mid"] || true; | ||
options["down"] = options["down"] || true; | ||
options["size"] = options["size"] || "maxi"; | ||
options["up"] = typeof options["up"] !== 'undefined' ? options["up"] : true; | ||
options["mid"] = typeof options["mid"] !== 'undefined' ? options["mid"] : true; | ||
options["down"] = typeof options["down"] !== 'undefined' ? options["down"] : true; | ||
options["size"] = typeof options["size"] !== 'undefined' ? options["size"] : "maxi"; | ||
text = text.split(''); | ||
@@ -76,3 +76,3 @@ for (l in text) { | ||
counts.up = randomNumber(8); | ||
counts.min = randomNumber(2); | ||
counts.mid = randomNumber(2); | ||
counts.down = randomNumber(8); | ||
@@ -82,3 +82,3 @@ break; | ||
counts.up = randomNumber(16) + 3; | ||
counts.min = randomNumber(4) + 1; | ||
counts.mid = randomNumber(4) + 1; | ||
counts.down = randomNumber(64) + 3; | ||
@@ -106,3 +106,3 @@ break; | ||
// don't summon him | ||
return heComes(text); | ||
return heComes(text, options); | ||
} |
@@ -1,3 +0,2 @@ | ||
var colors = require('./colors'), | ||
styles = require('./styles'); | ||
var colors = require('./colors'); | ||
@@ -21,6 +20,2 @@ module['exports'] = function () { | ||
var stylize = function stylize (str, style) { | ||
return styles[style].open + str + styles[style].close; | ||
} | ||
addProperty('strip', function () { | ||
@@ -64,3 +59,3 @@ return colors.strip(this); | ||
addProperty(style, function () { | ||
return stylize(this, style); | ||
return colors.stylize(this, style); | ||
}); | ||
@@ -67,0 +62,0 @@ }); |
@@ -12,2 +12,2 @@ var colors = require('./colors'); | ||
// | ||
var extendStringPrototype = require('./extendStringPrototype')(); | ||
require('./extendStringPrototype')(); |
{ | ||
"name": "colors", | ||
"description": "get colors in your node.js console", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"author": "Marak Squires", | ||
@@ -20,3 +20,10 @@ "homepage": "https://github.com/Marak/colors.js", | ||
}, | ||
"main": "./lib/index" | ||
"main": "lib", | ||
"files": [ | ||
"examples", | ||
"lib", | ||
"LICENSE", | ||
"safe.js", | ||
"themes" | ||
] | ||
} |
@@ -1,6 +0,6 @@ | ||
# colors.js | ||
# colors.js [![Build Status](https://travis-ci.org/Marak/colors.js.svg?branch=master)](https://travis-ci.org/Marak/colors.js) | ||
## get color and style in your node.js console | ||
<img src="https://github.com/Marak/colors.js/raw/master/screenshots/colors.png"/> | ||
![Demo](https://raw.githubusercontent.com/Marak/colors.js/master/screenshots/colors.png) | ||
@@ -28,4 +28,2 @@ ## Installation | ||
- bgBlack | ||
@@ -166,4 +164,16 @@ - bgRed | ||
console.log(colors.warn("this is a warning")); | ||
``` | ||
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.* | ||
You can also combine them: | ||
```javascript | ||
colors.setTheme({ | ||
link: ['underline', 'blue'] | ||
}); | ||
// outputs underlined blue text | ||
console.log(colors.info('Listening on ') + colors.link('http://0.0.0.0:' + port)); | ||
``` | ||
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.* |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
178
27373
18
658