summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDuncan Healy <duncan.healy@gmail.com>2019-11-13 17:59:45 +0000
committerAnna Henningsen <anna@addaleax.net>2019-11-28 00:53:55 +0100
commit80ac428996a98d3e5fa846d011cdc425d2d6a9ad (patch)
treeb17e533ee9970e8e701539e0997be69ddb2353d5 /lib
parent988034be6aece7bd103249e18ac7f0a5d3f92545 (diff)
downloadandroid-node-v8-80ac428996a98d3e5fa846d011cdc425d2d6a9ad.tar.gz
android-node-v8-80ac428996a98d3e5fa846d011cdc425d2d6a9ad.tar.bz2
android-node-v8-80ac428996a98d3e5fa846d011cdc425d2d6a9ad.zip
tty: truecolor check moved before 256 check
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/tty.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/internal/tty.js b/lib/internal/tty.js
index faf5df9b42..98975fa68a 100644
--- a/lib/internal/tty.js
+++ b/lib/internal/tty.js
@@ -173,6 +173,10 @@ function getColorDepth(env = process.env) {
return COLORS_256;
}
+ if (env.COLORTERM === 'truecolor' || env.COLORTERM === '24bit') {
+ return COLORS_16m;
+ }
+
if (env.TERM) {
if (/^xterm-256/.test(env.TERM))
return COLORS_256;
@@ -188,13 +192,10 @@ function getColorDepth(env = process.env) {
}
}
}
-
+ // Move 16 color COLORTERM below 16m and 256
if (env.COLORTERM) {
- if (env.COLORTERM === 'truecolor' || env.COLORTERM === '24bit')
- return COLORS_16m;
return COLORS_16;
}
-
return COLORS_2;
}