has16m is false but terminal supports Truecolor #62
bokub posted onGitHub
I found this issue using chalk, but it's color support related so I thought it was a better idea to submit my issue here.
Check out the following code. The same string is colored using the default chalk instance, a chalk forced to level 2, and a chalk forced to level 3.
// Default chalk
let chalk = require('chalk');
console.log(chalk.supportsColor);
print(chalk);
// 256 colors chalk
let ch256 = new chalk.constructor({level: 2});
print(ch256);
// Truecolor chalk
let ch16m = new chalk.constructor({level: 3});
print(ch16m);
function print(c) {
let result = '';
for(let i =0; i < 60; i++){
result += c.rgb(255 - 2*i, 0, 2*i)('â–ˆ');
}
console.log(' ' + result);
}
The supportsColor
returns this: { level: 2, hasBasic: true, has256: true, has16m: false }
, so it looks like my terminal does not support Truecolor.
However, the printed colors look like that:
It is clear that my terminal actually supports Truecolor. Why is it not detected ?
What if I always force level 3 in my code ? Can it impact users who only support 256 colors ?
Thanks a lot
supports-color version: 2.0.0 chalk version: 2.0.1 Ubuntu 16.04.2 LTS gnome-terminal 3.18.3