chalk 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chalk.js +4 -2
- package/package.json +1 -1
- package/readme.md +6 -2
package/chalk.js
CHANGED
|
@@ -27,7 +27,9 @@ function init() {
|
|
|
27
27
|
Object.keys(styles).forEach(function (name) {
|
|
28
28
|
ret[name] = {
|
|
29
29
|
get: function () {
|
|
30
|
-
var obj = defineProps(function self(
|
|
30
|
+
var obj = defineProps(function self() {
|
|
31
|
+
var str = [].slice.call(arguments).join(' ');
|
|
32
|
+
|
|
31
33
|
if (!chalk.enabled) {
|
|
32
34
|
return str;
|
|
33
35
|
}
|
|
@@ -51,7 +53,7 @@ function init() {
|
|
|
51
53
|
chalk.styles = ansi;
|
|
52
54
|
|
|
53
55
|
chalk.stripColor = function (str) {
|
|
54
|
-
return str.replace(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/g, '');
|
|
56
|
+
return typeof str === 'string' ? str.replace(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/g, '') : str;
|
|
55
57
|
};
|
|
56
58
|
|
|
57
59
|
chalk.supportsColor = require('has-color');
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -34,13 +34,16 @@ var chalk = require('chalk');
|
|
|
34
34
|
console.log(chalk.blue('Hello world!'));
|
|
35
35
|
|
|
36
36
|
// combine styled and normal strings
|
|
37
|
-
console.log(chalk.blue('Hello')
|
|
37
|
+
console.log(chalk.blue('Hello'), 'World' + chalk.red('!'));
|
|
38
38
|
|
|
39
39
|
// compose multiple styles using the chainable API
|
|
40
40
|
console.log(chalk.blue.bgRed.bold('Hello world!'));
|
|
41
41
|
|
|
42
42
|
// nest styles
|
|
43
|
-
chalk.red('Hello'
|
|
43
|
+
chalk.red('Hello', chalk.underline.bgBlue('world') + '!');
|
|
44
|
+
|
|
45
|
+
// pass in multiple arguments
|
|
46
|
+
console.log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'))
|
|
44
47
|
```
|
|
45
48
|
|
|
46
49
|
You can easily define your own themes.
|
|
@@ -58,6 +61,7 @@ console.log(error('Error!'));
|
|
|
58
61
|
|
|
59
62
|
Chain [styles](#styles) and call the last one as a method with a string argument.
|
|
60
63
|
|
|
64
|
+
Multiple arguments are also supported. Chalk will add a space between each one.
|
|
61
65
|
|
|
62
66
|
### chalk.enabled
|
|
63
67
|
|