summaryrefslogtreecommitdiff
path: root/lib/internal/tty.js
AgeCommit message (Collapse)Author
2019-11-28tty: truecolor check moved before 256 checkDuncan Healy
256 color would be return instead of 16m if both env variables were set * tty: improve color check order highest spec first * tty: add test for TERM and COLORTERM set * tty: move COLORTERM check outside TERM closure * tty: remove extra if check for COLORTERM Refs: https://github.com/nodejs/node/issues/27609 PR-URL: https://github.com/nodejs/node/pull/30474 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-10-05lib: introduce no-mixed-operators eslint rule to libZYSzys
PR-URL: https://github.com/nodejs/node/pull/29834 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-09-15tty: add color support for moshAditya
PR-URL: https://github.com/nodejs/node/pull/27843 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-03-25repl: fix terminal default settingRuben Bridgewater
This makes sure that the described default behavior for the `terminal` option is actually always used and not only when running the REPL as standalone program. The options code is now logically combined instead of being spread out in the big REPL constructor. PR-URL: https://github.com/nodejs/node/pull/26518 Reviewed-By: Lance Ball <lball@redhat.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-19tty: add NO_COLOR and FORCE_COLOR supportRuben Bridgewater
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: https://github.com/nodejs/node/pull/26485 Refs: https://github.com/nodejs/node/pull/26248 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2019-03-05tty: add hasColors functionRuben Bridgewater
This adds a small wrapper around the `getColorDepth` function to check if the stream supports at least a specific amount of colors. This is convenient as the other API is not as straight forward and most use cases likely only want to know if a specific amount of colors is supported or not. PR-URL: https://github.com/nodejs/node/pull/26247 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2019-03-03tty: improve color detectionRuben Bridgewater
1) Using `process.env.TERM = 'dumb'` should never return any colors. 2) `process.env.TERM = 'terminator'` supports 24 bit colors. 3) Add support for `process.env.TERM = 'rxvt-unicode-24bit'` 4) `Hyper` does not support true colors anymore. It should fall back to the xterm settings in regular cases. 5) `process.env.COLORTERM = 'truecolor'` should return 24 bit colors. PR-URL: https://github.com/nodejs/node/pull/26264 Refs: https://github.com/nodejs/node/pull/26261 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-19lib: converted element to lowercase in tty.jsAbhishek Agarwal
Converted the first element "Eterm" in TERM_ENVS array to "eterm" PR-URL: https://github.com/nodejs/node/pull/26121 Fixes: https://github.com/nodejs/node/issues/26077 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2018-05-18os: lazy loadedRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/20567 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2018-04-04tty: add color support for more terminalsRuben Bridgewater
This adds support for a couple more terminals. PR-URL: https://github.com/nodejs/node/pull/19730 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-04tty: add attribution for chalkRuben Bridgewater
This adds attributions for the getColorDepth function as it got inspired by https://github.com/chalk/supports-color and more sources. PR-URL: https://github.com/nodejs/node/pull/19730 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>