diff --git a/index.js b/index.js index 9f37f47..bbf9ef1 100644 --- a/index.js +++ b/index.js @@ -50,14 +50,15 @@ function supportsColor(stream) { // libuv that enables 256 color output on Windows. Anything earlier and it // won't work. However, here we target Node.js 8 at minimum as it is an LTS // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows - // release that supports 256 colors. + // release that supports 256 colors. Windows 10 build 14931 is the first release + // that supports 16m/TrueColor. const osRelease = os.release().split('.'); if ( Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586 ) { - return 2; + return Number(osRelease[2]) >= 14931 ? 3 : 2; } return 1; diff --git a/test.js b/test.js index 7688146..e99a022 100644 --- a/test.js +++ b/test.js @@ -295,3 +295,15 @@ test('return level 2 if on Windows 10 build 10586 or later and Node version is > const result = importFresh('.'); t.is(result.stdout.level, 2); }); + +test('return level 3 if on Windows 10 build 14931 or later and Node version is >= 8.0.0', t => { + Object.defineProperty(process, 'platform', { + value: 'win32' + }); + Object.defineProperty(process.versions, 'node', { + value: '8.0.0' + }); + os.release = () => '10.0.14931'; + const result = importFresh('.'); + t.is(result.stdout.level, 3); +});