From d6e08c83d0e24241cb7d24206ef8753e839103eb Mon Sep 17 00:00:00 2001 From: Jaen Date: Fri, 2 Mar 2018 01:06:46 -0800 Subject: [PATCH] Check the COLORTERM variable for 16M color support (#75) According to https://gist.github.com/XVilka/8346728#detection and empirical tests on Konsole, when `COLORTERM=truecolor`, 24-bit color support is guaranteed to work. --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index dd33879..d0d008a 100644 --- a/index.js +++ b/index.js @@ -88,6 +88,10 @@ function supportsColor(stream) { return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } + if (env.COLORTERM === 'truecolor') { + return 3; + } + if ('TERM_PROGRAM' in env) { const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);