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

tty: add NO_COLOR and FORCE_COLOR support #26485

Closed
wants to merge 2 commits into from

Conversation

@BridgeAR
Copy link
Member

commented Mar 7, 2019

This adds support to enforce a specific color depth by checking the
FORCE_COLOR environment variable similar to chalk.

On top of that we also add support for the NO_COLOR environment
variable as suggested by https://no-color.org/.

Refs: #26248

This supersedes #26248.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@BridgeAR BridgeAR requested review from Trott, targos, vsemozhetbyt and starkwang Mar 7, 2019

@BridgeAR BridgeAR referenced this pull request Mar 7, 2019

Closed

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

4 of 4 tasks complete

@BridgeAR BridgeAR requested a review from addaleax Mar 7, 2019

@BridgeAR

This comment has been minimized.

tty: add NO_COLOR and FORCE_COLOR support
This adds support to enforce a specific color depth by checking the
`FORCE_COLOR` environment variable similar to `chalk`.

On top of that we also add support for the `NO_COLOR` environment
variable as suggested by https://no-color.org/.

@BridgeAR BridgeAR force-pushed the BridgeAR:add-force-color branch from b1653fb to af0b138 Mar 7, 2019

@BridgeAR BridgeAR referenced this pull request Mar 7, 2019

Open

Add Jest to lookup #684

@BridgeAR BridgeAR requested review from mcollina, mhdawson and silverwind Mar 8, 2019

@silverwind
Copy link
Contributor

left a comment

LGTM, thought some sort of standardization attempt for FORCE_COLOR and especially its values would be nice.

@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Mar 8, 2019

@silverwind I am already working in that direction and opened issues in the no-color repository and want to achieve some consolidations with true color support and things like that and suggest some things to some people who work on terminal colors.

@vsemozhetbyt
Copy link
Member

left a comment

Doc format LGTM with nits.

Show resolved Hide resolved doc/api/tty.md Outdated
Show resolved Hide resolved doc/api/tty.md Outdated
Show resolved Hide resolved doc/api/tty.md Outdated
Show resolved Hide resolved doc/api/tty.md Outdated
@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Mar 9, 2019

@BridgeAR BridgeAR referenced this pull request Mar 10, 2019

Closed

lib: support dumb terminals #26261

3 of 3 tasks complete
@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Mar 10, 2019

@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Mar 12, 2019

It would be nice to get some further reviews @nodejs/repl @nodejs/util

@BridgeAR BridgeAR requested review from danbev, jasnell, jdalton and lance Mar 15, 2019

case '':
case '1':
case 'true':
warnOnDeactivatedColors(env);

This comment has been minimized.

Copy link
@Fishrock123

Fishrock123 Mar 18, 2019

Member

Place this above the switch?

This comment has been minimized.

Copy link
@BridgeAR

BridgeAR Mar 18, 2019

Author Member

When moved above the switch, I'll have to exclude a lot of values. That's why it's inside.

BridgeAR added a commit to BridgeAR/node that referenced this pull request Mar 19, 2019

tty: add NO_COLOR and FORCE_COLOR support
This adds support to enforce a specific color depth by checking the
`FORCE_COLOR` environment variable similar to `chalk`.

On top of that we also add support for the `NO_COLOR` environment
variable as suggested by https://no-color.org/.

PR-URL: nodejs#26485
Refs: nodejs#26248
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Mar 19, 2019

Landed in 273398a 🎉

@BridgeAR BridgeAR closed this Mar 19, 2019

targos added a commit to targos/node that referenced this pull request Mar 27, 2019

tty: add NO_COLOR and FORCE_COLOR support
This adds support to enforce a specific color depth by checking the
`FORCE_COLOR` environment variable similar to `chalk`.

On top of that we also add support for the `NO_COLOR` environment
variable as suggested by https://no-color.org/.

PR-URL: nodejs#26485
Refs: nodejs#26248
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>

targos added a commit to targos/node that referenced this pull request Mar 27, 2019

tty: add NO_COLOR and FORCE_COLOR support
This adds support to enforce a specific color depth by checking the
`FORCE_COLOR` environment variable similar to `chalk`.

On top of that we also add support for the `NO_COLOR` environment
variable as suggested by https://no-color.org/.

PR-URL: nodejs#26485
Refs: nodejs#26248
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>

targos added a commit to targos/node that referenced this pull request Mar 27, 2019

tty: add NO_COLOR and FORCE_COLOR support
This adds support to enforce a specific color depth by checking the
`FORCE_COLOR` environment variable similar to `chalk`.

On top of that we also add support for the `NO_COLOR` environment
variable as suggested by https://no-color.org/.

PR-URL: nodejs#26485
Refs: nodejs#26248
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>

targos added a commit that referenced this pull request Mar 27, 2019

tty: add NO_COLOR and FORCE_COLOR support
This adds support to enforce a specific color depth by checking the
`FORCE_COLOR` environment variable similar to `chalk`.

On top of that we also add support for the `NO_COLOR` environment
variable as suggested by https://no-color.org/.

PR-URL: #26485
Refs: #26248
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>

targos added a commit that referenced this pull request Mar 27, 2019

2019-03-28, Version 11.13.0 (Current)
Notable changes:

* events:
  * Added a `once` function to use `EventEmitter` with promises
    (#26078).
* tty:
  * Added a `hasColors` method to `WriteStream`
    (#26247).
  * Added NO_COLOR and FORCE_COLOR support
    (#26485).
* v8:
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools
    (#26501).
* meta:
  * Gireesh Punathil is now a member of the Technical Steering Committee
    (#26657).
  * Added ZYSzys to collaborators (#26730).

targos added a commit that referenced this pull request Mar 27, 2019

2019-03-28, Version 11.13.0 (Current)
Notable changes:

* events:
  * Added a `once` function to use `EventEmitter` with promises
    (#26078).
* tty:
  * Added a `hasColors` method to `WriteStream`
    (#26247).
  * Added NO_COLOR and FORCE_COLOR support
    (#26485).
* v8:
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools
    (#26501).
* meta:
  * Gireesh Punathil is now a member of the Technical Steering Committee
    (#26657).
  * Added ZYSzys to collaborators (#26730).

PR-URL: #26949

@targos targos referenced this pull request Mar 27, 2019

Merged

v11.13.0 release proposal #26949

targos added a commit that referenced this pull request Mar 28, 2019

2019-03-28, Version 11.13.0 (Current)
Notable changes:

* crypto
  * Allow deriving public from private keys (Tobias Nießen)
    [#26278](#26278).
* events
  * Added a `once` function to use `EventEmitter` with promises
    (Matteo Collina) [#26078](#26078).
* tty
  * Added a `hasColors` method to `WriteStream` (Ruben Bridgewater)
    [#26247](#26247).
  * Added NO_COLOR and FORCE_COLOR support (Ruben Bridgewater)
    [#26485](#26485).
* v8
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools (James M Snell)
    [#26501](#26501).
* worker
  * Added `worker.moveMessagePortToContext`. This enables using MessagePorts in
    different vm.Contexts, aiding with the isolation that the vm module seeks to
    provide (Anna Henningsen)
    [#26497](#26497).
* C++ API
  * `AddPromiseHook` is now deprecated. This API was added to fill an use case
    that is served by `async_hooks`, since that has `Promise` support
    (Anna Henningsen) [#26529](#26529).
  * Added a `Stop` API to shut down Node.js while it is running
    (Gireesh Punathil) [#21283](#21283).
* meta
  * [Gireesh Punathil](https://github.com/gireeshpunathil) is now a member of
    the Technical Steering Committee
    [#26657](#26657).
  * Added [Yongsheng Zhang](https://github.com/ZYSzys) to collaborators
    [#26730](#26730).

PR-URL: #26949

targos added a commit that referenced this pull request Mar 28, 2019

2019-03-28, Version 11.13.0 (Current)
Notable changes:

* crypto
  * Allow deriving public from private keys (Tobias Nießen)
    [#26278](#26278).
* events
  * Added a `once` function to use `EventEmitter` with promises
    (Matteo Collina) [#26078](#26078).
* tty
  * Added a `hasColors` method to `WriteStream` (Ruben Bridgewater)
    [#26247](#26247).
  * Added NO_COLOR and FORCE_COLOR support (Ruben Bridgewater)
    [#26485](#26485).
* v8
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools (James M Snell)
    [#26501](#26501).
* worker
  * Added `worker.moveMessagePortToContext`. This enables using MessagePorts in
    different vm.Contexts, aiding with the isolation that the vm module seeks to
    provide (Anna Henningsen)
    [#26497](#26497).
* C++ API
  * `AddPromiseHook` is now deprecated. This API was added to fill an use case
    that is served by `async_hooks`, since that has `Promise` support
    (Anna Henningsen) [#26529](#26529).
  * Added a `Stop` API to shut down Node.js while it is running
    (Gireesh Punathil) [#21283](#21283).
* meta
  * [Gireesh Punathil](https://github.com/gireeshpunathil) is now a member of
    the Technical Steering Committee
    [#26657](#26657).
  * Added [Yongsheng Zhang](https://github.com/ZYSzys) to collaborators
    [#26730](#26730).

PR-URL: #26949

BethGriggs added a commit that referenced this pull request Apr 5, 2019

2019-03-28, Version 11.13.0 (Current)
Notable changes:

* crypto
  * Allow deriving public from private keys (Tobias Nießen)
    [#26278](#26278).
* events
  * Added a `once` function to use `EventEmitter` with promises
    (Matteo Collina) [#26078](#26078).
* tty
  * Added a `hasColors` method to `WriteStream` (Ruben Bridgewater)
    [#26247](#26247).
  * Added NO_COLOR and FORCE_COLOR support (Ruben Bridgewater)
    [#26485](#26485).
* v8
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools (James M Snell)
    [#26501](#26501).
* worker
  * Added `worker.moveMessagePortToContext`. This enables using MessagePorts in
    different vm.Contexts, aiding with the isolation that the vm module seeks to
    provide (Anna Henningsen)
    [#26497](#26497).
* C++ API
  * `AddPromiseHook` is now deprecated. This API was added to fill an use case
    that is served by `async_hooks`, since that has `Promise` support
    (Anna Henningsen) [#26529](#26529).
  * Added a `Stop` API to shut down Node.js while it is running
    (Gireesh Punathil) [#21283](#21283).
* meta
  * [Gireesh Punathil](https://github.com/gireeshpunathil) is now a member of
    the Technical Steering Committee
    [#26657](#26657).
  * Added [Yongsheng Zhang](https://github.com/ZYSzys) to collaborators
    [#26730](#26730).

PR-URL: #26949
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.