Comments (16)
@Delta456 https://blog.sindresorhus.com/issue-bumping-e3b9740e2a0
from supports-color.
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.
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.
$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.
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.
However, the command
ps -p$PPID
returns the following:
We can't spawn a child process. That's too expensive.
from supports-color.
What does echo $VTE_VERSION
and echo $COLORTERM
(this one doesn't work in later versions of gnome-terminal
) give you?
from supports-color.
$VTE_VERSION
is 4205
$COLORTERM
is undefined
from supports-color.
@kevva I can't immediately find any docs on VTE_VERSION
- what is it?
from supports-color.
It's set by gnome-terminal
and shows the vte
version. We can probably use that flag to detect gnome-terminal
.
from supports-color.
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.
Just the existence I think. I'm not aware of any other program setting it.
from supports-color.
@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.
Is this issue fixed now?
from supports-color.
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.
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)
- Implementing the NO_COLOR environment variable standard HOT 1
- support for NO_COLOR env var HOT 5
- False-negative on GitHub Actions HOT 22
- What is wrong with the native `writeStream.getColorDepth`? HOT 3
- How to force using colors from browser? HOT 1
- Broken build with rollup for node due to global "navigator" HOT 6
- supportsColor() should recheck process.env.FORCE_COLOR HOT 2
- Change to ESM causes backwards compatibility issues HOT 3
- Implement `NO_COLOR` informal specification HOT 1
- "Can't resolve node:tty" when using nextjs and yarn 3 HOT 1
- No way to force color in browser HOT 9
- `navigator.userAgentData` HOT 1
- Support importing via deno HOT 3
- GitHub Action support truecolor HOT 1
- SyntaxError in index.js HOT 2
- My terminal emulator (mobaxterm) supports truecolor, but supports-color doesn't detect it HOT 4
- Package published without README HOT 1
- Claimed support for Node.js v12 missing HOT 10
- process is not defined in supports-colors.js HOT 1
- `FORCE_COLOR` testcases failing (fixed 2) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from supports-color.