diff --git a/doc/api/tty.md b/doc/api/tty.md index 12a34b14eb7cc0..4edc3ad86e11d5 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -144,8 +144,9 @@ position. added: v9.9.0 --> -* `env` {Object} An object containing the environment variables to check. - **Default:** `process.env`. +* `env` {Object} An object containing the environment variables to check. This + enables simulating the usage of a specific terminal. **Default:** + `process.env`. * Returns: {number} Returns: @@ -159,11 +160,18 @@ Use this to determine what colors the terminal supports. Due to the nature of colors in terminals it is possible to either have false positives or false negatives. It depends on process information and the environment variables that may lie about what terminal is used. -To enforce a specific behavior without relying on `process.env` it is possible -to pass in an object with different settings. +It is possible to pass in an `env` object to simulate the usage of a specific +terminal. This can be useful to check how specific environment settings behave. + +To enforce a specific color support, use one of the below environment settings. + +* 2 colors: `FORCE_COLOR = 0` (Disables colors) +* 16 colors: `FORCE_COLOR = 1` +* 256 colors: `FORCE_COLOR = 2` +* 16,777,216 colors: `FORCE_COLOR = 3` -Use the `NODE_DISABLE_COLORS` environment variable to enforce this function to -always return 1. +Disabling color support is also possible by using the `NO_COLOR` and +`NODE_DISABLE_COLORS` environment variables. ### writeStream.getWindowSize()