supports-color
Advanced tools
Comparing version 4.0.0 to 4.1.0
15
index.js
'use strict'; | ||
const os = require('os'); | ||
const hasFlag = require('has-flag'); | ||
@@ -48,2 +49,16 @@ | ||
if (process.platform === 'win32') { | ||
// Node.js 7.5.0 is the first version of Node.js to include a patch to | ||
// 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. | ||
const osRelease = os.release().split('.'); | ||
if ( | ||
Number(process.version.split('.')[0]) >= 8 && | ||
Number(osRelease[0]) >= 10 && | ||
Number(osRelease[2]) >= 10586 | ||
) { | ||
return 2; | ||
} | ||
return 1; | ||
@@ -50,0 +65,0 @@ } |
{ | ||
"name": "supports-color", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Detect whether a terminal supports color", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -40,3 +40,3 @@ # supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color) | ||
- `.level = 2` and `.has256 = true`: 256 color support | ||
- `.level = 3` and `.has16m = true`: 16 million (truecolor) support | ||
- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors) | ||
@@ -48,5 +48,5 @@ | ||
For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR=1` to forcefully enable color and `FORCE_COLOR=0` forcefully disable. The use of `FORCE_COLOR` overrides all other color checks performed by this module. | ||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks. | ||
Explicit 256/truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. | ||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. | ||
@@ -53,0 +53,0 @@ |
5995
95