has16m is false but terminal supports Truecolor
See original GitHub issueI 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
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
has16m is false but terminal supports Truecolor #62 - Issuehunt
I found this issue using chalk, but it's color support related so I thought it was a better idea to submit my issue...
Read more >jwalton/go-supportscolor: Detects whether a terminal ... - GitHub
Detects whether a terminal supports color, and enables ANSI color support in recent Windows 10 ... Has16m = true : True color support...
Read more >Check if terminal supports 24-bit / true color
Terminals that don't support 24-bit colour will ignore the second escape code and use the less-precise colour from the palette, while those ...
Read more >Color-support NPM | npm.io
A module which will endeavor to guess your terminal's level of color support. Build Status · Coverage Status. This is similar to supports-color...
Read more >color-support - npm
This is similar to supports-color , but it does not read ... These terminals support 16m colors: ... else if (colorSupport.has16m) {.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Delta456 https://blog.sindresorhus.com/issue-bumping-e3b9740e2a0
There’s no way we’re bringing in a native module to
supports-color
, sorry.Unless the terminal emulator exposes a way for us to detect the truecolor support (since traditional ways such as terminfo have not evolved to keep up) there’s nothing actionable we can do.
We’ve not heard back in over a year so I’m going to close this since there’s nothing (currently) actionable.