question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

has16m is false but terminal supports Truecolor

See original GitHub issue

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: capture du 2017-07-19 17-22-42

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:closed
  • Created 6 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

0reactions
Qix-commented, Dec 13, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found