Skip to content

Commit d6e08c8

Browse files
jaenssindresorhus
authored andcommitted
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.
1 parent b764af9 commit d6e08c8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ function supportsColor(stream) {
8888
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
8989
}
9090

91+
if (env.COLORTERM === 'truecolor') {
92+
return 3;
93+
}
94+
9195
if ('TERM_PROGRAM' in env) {
9296
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
9397

0 commit comments

Comments
 (0)