Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add examples for tty.getColorDepth() env #26248

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions doc/api/tty.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,14 @@ 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.

Use the `NODE_DISABLE_COLORS` environment variable to enforce this function to
always return 1.
To enforce a specific color support, use one of the below environment settings.
This rule does not apply to Windows OS, CI environments, and some other rare
cases. Only disabling color support with `NODE_DISABLE_COLORS` will always work.

* 2 colors: `NODE_DISABLE_COLORS = 1`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works on Windows

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I updated the comment again to reflect that. PTAL.

* 16 colors: `TERM = 'console'`
* 256 colors: `TMUX = 1`
* 16,777,216 colors: `TERM_PROGRAM = 'Hyper'`

### writeStream.getWindowSize()
<!-- YAML
Expand Down