Git Product home page Git Product logo

Comments (16)

sindresorhus avatar sindresorhus commented on September 2, 2024 1

@Delta456 https://blog.sindresorhus.com/issue-bumping-e3b9740e2a0

from supports-color.

Qix- avatar Qix- commented on September 2, 2024

Right now, no. Terminals don't expose anything that identifies them having 16m colors, unfortunately.

@sindresorhus we should make more progress on that.

from supports-color.

sindresorhus avatar sindresorhus commented on September 2, 2024

We could hard-code it if gnome-terminal exposes its name somehow.

@bokub What's the output of running echo $TERM_PROGRAM?

from supports-color.

bokub avatar bokub commented on September 2, 2024

$TERM_PROGRAM is empty, $TERM is xterm-256color, unfortunately.

However, the command ps -p$PPID returns the following:

  PID TTY          TIME CMD
 3798 ?        00:00:13 gnome-terminal-

You could check if the result of the command contains gnome-terminal.


What if I always force level 3 in my code ? Can it impact users who only support 256 colors ?

Were you answering this question when you said 'Right now, no' @Qix- ? Is it a good idea or not to force level 3 ?

from supports-color.

Qix- avatar Qix- commented on September 2, 2024

What if I always force level 3 in my code ? Can it impact users who only support 256 colors ?

Yeah don't do that. It'll cause a lot of issues for users that don't have the new codes - the best case is that they won't see any color, worst case is they get output [38;2;185;2;217mlike this.

from supports-color.

sindresorhus avatar sindresorhus commented on September 2, 2024

However, the command ps -p$PPID returns the following:

We can't spawn a child process. That's too expensive.

from supports-color.

kevva avatar kevva commented on September 2, 2024

What does echo $VTE_VERSION and echo $COLORTERM (this one doesn't work in later versions of gnome-terminal) give you?

from supports-color.

bokub avatar bokub commented on September 2, 2024

$VTE_VERSION is 4205
$COLORTERM is undefined

from supports-color.

Qix- avatar Qix- commented on September 2, 2024

@kevva I can't immediately find any docs on VTE_VERSION - what is it?

from supports-color.

kevva avatar kevva commented on September 2, 2024

It's set by gnome-terminal and shows the vte version. We can probably use that flag to detect gnome-terminal.

from supports-color.

Qix- avatar Qix- commented on September 2, 2024

Is there a corresponding version we can use to more accurately detect the level of support? Or just the existence of the variable?

from supports-color.

kevva avatar kevva commented on September 2, 2024

Just the existence I think. I'm not aware of any other program setting it.

from supports-color.

sindresorhus avatar sindresorhus commented on September 2, 2024

@bokub Can you open an issue on the gnome-terminal issue tracker asking them to implement $TERM_PROGRAM and $TERM_PROGRAM_VERSION?

from supports-color.

Delta456 avatar Delta456 commented on September 2, 2024

Is this issue fixed now?

from supports-color.

Delta456 avatar Delta456 commented on September 2, 2024

I am sorry if I bumped it but I think we can use node-cpp for the system api to detect it.

from supports-color.

Qix- avatar Qix- commented on September 2, 2024

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.

from supports-color.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.