readme - add string substitution example

Fixes #8
This commit is contained in:
Sindre Sorhus 2013-12-16 21:44:25 +01:00
parent b0addb86d6
commit 13a555ede8

View file

@ -49,7 +49,7 @@ console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') );
console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') );
```
You can easily define your own themes.
Easily define your own themes.
```js
var chalk = require('chalk');
@ -57,6 +57,14 @@ var error = chalk.bold.red;
console.log(error('Error!'));
```
Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data).
```js
var name = 'Sindre';
console.log(chalk.green('Hello %s'), name);
//=> Hello Sindre
```
## API