Add log statement to chalk examples

Added what are essentially `console.log()` calls to the chalk examples.

Closes #128.
This commit is contained in:
Josh Junon 2016-09-07 21:03:09 -07:00 committed by GitHub
parent 835ca3d950
commit 18d530193b

View file

@ -47,29 +47,28 @@ console.log(chalk.blue('Hello world!'));
Chalk comes with an easy to use composable API where you just chain and nest the styles you want. Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
Here without `console.log` for purity.
```js ```js
const chalk = require('chalk'); const chalk = require('chalk');
const log = console.log;
// combine styled and normal strings // combine styled and normal strings
chalk.blue('Hello') + 'World' + chalk.red('!'); log(chalk.blue('Hello') + 'World' + chalk.red('!'));
// compose multiple styles using the chainable API // compose multiple styles using the chainable API
chalk.blue.bgRed.bold('Hello world!'); log(chalk.blue.bgRed.bold('Hello world!'));
// pass in multiple arguments // pass in multiple arguments
chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'); log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
// nest styles // nest styles
chalk.red('Hello', chalk.underline.bgBlue('world') + '!'); log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
// nest styles of the same type even (color, underline, background) // nest styles of the same type even (color, underline, background)
chalk.green( log(chalk.green(
'I am a green line ' + 'I am a green line ' +
chalk.blue.underline.bold('with a blue substring') + chalk.blue.underline.bold('with a blue substring') +
' that becomes green again!' ' that becomes green again!'
); ));
// ES2015 template literal // ES2015 template literal
const systemStats = ` const systemStats = `