tty: improve color terminal color detection · nodejs/node@ddab63a

@@ -37,13 +37,18 @@ const writeStream = new WriteStream(fd);

3737

[{ COLORTERM: '1' }, 4],

3838

[{ COLORTERM: 'truecolor' }, 24],

3939

[{ COLORTERM: '24bit' }, 24],

40-

[{ TMUX: '1' }, 8],

40+

[{ TMUX: '1' }, 24],

4141

[{ CI: '1' }, 1],

42-

[{ CI: '1', TRAVIS: '1' }, 8],

43-

[{ CI: '1', CIRCLECI: '1' }, 8],

44-

[{ CI: '1', APPVEYOR: '1' }, 8],

45-

[{ CI: '1', GITLAB_CI: '1' }, 8],

42+

[{ CI: '', APPVEYOR: '1' }, 8],

43+

[{ CI: '1', BUILDKITE: '' }, 8],

4644

[{ CI: '1', CI_NAME: 'codeship' }, 8],

45+

[{ CI: '1', CIRCLECI: '1' }, 24],

46+

[{ CI: '1', DRONE: '' }, 8],

47+

[{ CI: '1', GITEA_ACTIONS: '' }, 24],

48+

[{ CI: '1', GITHUB_ACTIONS: '' }, 24],

49+

[{ CI: '1', GITLAB_CI: '1' }, 8],

50+

[{ CI: '1', TRAVIS: '1' }, 8],

51+

[{ CI: '', TRAVIS: '' }, 8],

4752

[{ TEAMCITY_VERSION: '1.0.0' }, 1],

4853

[{ TEAMCITY_VERSION: '9.11.0' }, 4],

4954

[{ TERM_PROGRAM: 'iTerm.app' }, 8],

@@ -53,17 +58,22 @@ const writeStream = new WriteStream(fd);

5358

[{ TERM_PROGRAM: 'Hyper' }, 1],

5459

[{ TERM_PROGRAM: 'MacTerm' }, 24],

5560

[{ TERM_PROGRAM: 'Apple_Terminal' }, 8],

56-

[{ TERM: 'xterm-256' }, 8],

5761

[{ TERM: 'ansi' }, 4],

5862

[{ TERM: 'ANSI' }, 4],

5963

[{ TERM: 'color' }, 4],

60-

[{ TERM: 'linux' }, 4],

61-

[{ TERM: 'fail' }, 1],

6264

[{ TERM: 'color', NODE_DISABLE_COLORS: '1' }, 1],

65+

[{ TERM: 'console' }, 4],

66+

[{ TERM: 'direct' }, 4],

6367

[{ TERM: 'dumb' }, 1],

6468

[{ TERM: 'dumb', COLORTERM: '1' }, 1],

69+

[{ TERM: 'fail' }, 1],

70+

[{ TERM: 'linux' }, 4],

6571

[{ TERM: 'terminator' }, 24],

66-

[{ TERM: 'console' }, 4],

72+

[{ TERM: 'vt100' }, 4],

73+

[{ TERM: 'vt220' }, 4],

74+

[{ TERM: 'xterm-256' }, 8],

75+

[{ TERM: 'xterm-kitty' }, 24],

76+

[{ TERM: 'xterm-truecolor' }, 24],

6777

[{ COLORTERM: '24bit', FORCE_COLOR: '' }, 4],

6878

[{ NO_COLOR: '1', FORCE_COLOR: '2' }, 8],

6979

[{ NODE_DISABLE_COLORS: '1', FORCE_COLOR: '3' }, 24],

@@ -72,6 +82,7 @@ const writeStream = new WriteStream(fd);

7282

[{ TMUX: '1', FORCE_COLOR: 0 }, 1],

7383

[{ NO_COLOR: 'true', FORCE_COLOR: 0, COLORTERM: 'truecolor' }, 1],

7484

[{ TERM: 'xterm-256color', COLORTERM: 'truecolor' }, 24],

85+

[{ TF_BUILD: '', AGENT_NAME: '' }, 4],

7586

].forEach(([env, depth], i) => {

7687

const actual = writeStream.getColorDepth(env);

7788

assert.strictEqual(