diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-03-15 14:09:17 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-04-12 23:23:56 +0200 |
commit | 57e8793c4393aa3fafd87f289b19078b1918c166 (patch) | |
tree | a1076b73991a97ed829cf0da0e5747d611ccec78 /doc | |
parent | ce58df58d0360779d16d60ce3bb0e9979ec5fdf4 (diff) | |
download | android-node-v8-57e8793c4393aa3fafd87f289b19078b1918c166.tar.gz android-node-v8-57e8793c4393aa3fafd87f289b19078b1918c166.tar.bz2 android-node-v8-57e8793c4393aa3fafd87f289b19078b1918c166.zip |
console: add color support
Add a way to tell `Console` instances to either always use, never use
or auto-detect color support and inspect objects accordingly.
PR-URL: https://github.com/nodejs/node/pull/19372
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/console.md | 8 | ||||
-rw-r--r-- | doc/api/util.md | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/doc/api/console.md b/doc/api/console.md index 99c31df242..cce2a4eb6e 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -87,7 +87,8 @@ changes: description: The `ignoreErrors` option was introduced. - version: REPLACEME pr-url: https://github.com/nodejs/node/pull/19372 - description: The `Console` constructor now supports an `options` argument. + description: The `Console` constructor now supports an `options` argument, + and the `colorMode` option was introduced. --> * `options` {Object} @@ -95,6 +96,11 @@ changes: * `stderr` {stream.Writable} * `ignoreErrors` {boolean} Ignore errors when writing to the underlying streams. **Default:** `true`. + * `colorMode` {boolean|string} Set color support for this `Console` instance. + Setting to `true` enables coloring while inspecting values, setting to + `'auto'` will make color support depend on the value of the `isTTY` property + and the value returned by `getColorDepth()` on the respective stream. + **Default:** `false` Creates a new `Console` with one or two writable stream instances. `stdout` is a writable stream to print log or info output. `stderr` is used for warning or diff --git a/doc/api/util.md b/doc/api/util.md index 23a1774a1f..e8f97397d3 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -268,8 +268,8 @@ an `inspectOptions` argument which specifies options that are passed along to ```js util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); - // Returns 'See object { foo: 42 }', where `42` is colored as a number - // when printed to a terminal. +// Returns 'See object { foo: 42 }', where `42` is colored as a number +// when printed to a terminal. ``` ## util.getSystemErrorName(err) |