You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update terminal environment variables to detect colors #27609
Right now we have a pretty decent list of environment variables to detect different terminals that support colors. However, it is often not exactly known from what version on these terminals actually support the colors, if that's detectable and how many colors these support.
I would like to start a list of different terminals / CIs and other things including their corresponding environment variables or other information to detect these and the information how many colors they support.
Anyone can please check their terminal and post the name, version, corresponding env settings (not all) and the supported colors. This should be pretty straight forward and a good first contribution! The more information we gather here, the better Node.js will become in properly supporting colors.
Just enter the following in your terminal to check for true color:
printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"
Update: Please make sure you check what environment variables are set by your terminal! That is important since not all correspond to $TERM but some also to e.g., $TERM_PROGRAM. You can check what environment variables are set by running: node -e 'console.log(process.env)'. You have to check what environment variables correspond to the terminal. Please do not post any environment variables besides those.
@rpgeeganage please go for it. It is all JS. This is mainly meant as a tracking issue.
@mscdex it's definitely not a fool prove solution. I tried very hard to come up with anything or find something but this seemed to be the best we can do so far. If there's any reliable alternative (even only to reliable detect a few terminals), we should go for that instead.
Ok, I'm using iTerm2, and I ran the script above printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"
and it returns 'TURECOLOR'. Here is also a screen cap of my terminal running this function from the docs above about terminal color.
@BridgeAR I went ahead and created this PR tty: add color support for iterm2 #27722 please let me know if there is anything I can do if there is an issue.
COLORTERM:truecolor is covered in test/pseudo-tty/test-tty-color-support.js but TERM: xterm-256color is not covered.
Although TERM: xterm is in the file
Please confirm if I whould edit it
Hi @BridgeAR a question, is this issue still open? I've seen that the last comment or commit referencing this issue was like a year ago, I am new to open source and I know is nothing about coding, but would like to at least contribute with something.
Or do you know if there's a good new issue to work with?
Activity
mscdex commentedon May 8, 2019
VTE-based terminals should automatically export
VTE_VERSIONwith the VTE version value (e.g.5202for v0.52.2).However, other terminals like qterminal (which does support truecolor) don't set anything, not even
COLORTERMcurrently.Something else to keep in mind is that environment variables like these typically are not allowed to pass through on SSH connections.
rpgeeganage commentedon May 8, 2019
@BridgeAR ,
May I give this a try? (I hope this only in
Javascriptcode :) )BridgeAR commentedon May 8, 2019
@rpgeeganage please go for it. It is all JS. This is mainly meant as a tracking issue.
@mscdex it's definitely not a fool prove solution. I tried very hard to come up with anything or find something but this seemed to be the best we can do so far. If there's any reliable alternative (even only to reliable detect a few terminals), we should go for that instead.
rpgeeganage commentedon May 8, 2019
@BridgeAR
Thank you very much. I'll start working on it probably from tomorrow onward.
3mard commentedon May 13, 2019
Can I give this a try ? :)
rpgeeganage commentedon May 13, 2019
@3mard ,
Please go ahead, Thanks a lot.
dlionz commentedon May 15, 2019
Hello, Id like to give this a go as well, but I'm not entirely sure what is expected.
is it just as simple as adding my Terminal name to the TERM_ENVS object and the colors it supports?
BridgeAR commentedon May 15, 2019
@dlionz that is pretty much exactly what's required. We could also start a list here.
dlionz commentedon May 15, 2019
@BridgeAR, thanks for the quick response.
Ok, I'm using iTerm2, and I ran the script above
printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"and it returns 'TURECOLOR'. Here is also a screen cap of my terminal running this function from the docs above about terminal color.
is this all that is needed?
dlionz commentedon May 15, 2019
@BridgeAR I went ahead and created this PR tty: add color support for iterm2 #27722 please let me know if there is anything I can do if there is an issue.
thanks,
Damien
rpgeeganage commentedon May 15, 2019
@dlionz,
Your PR seems to be not following the contributing guideline. Can you please check it?
dlionz commentedon May 15, 2019
@rpgeeganage Yeah can do, just realized I did it wrong.
12 remaining items
sarthak0906 commentedon Nov 26, 2019
Hey is this issue still open
I would like to contribute
duncanhealy commentedon Nov 26, 2019
if you run
env |grep TERMyou can check if your terminal settings are covered intest/pseudo-tty/test-tty-color-support.jssarthak0906 commentedon Nov 26, 2019
On Ubuntu 18.04.3
COLORTERM:truecoloris covered intest/pseudo-tty/test-tty-color-support.jsbutTERM: xterm-256coloris not covered.Although
TERM: xtermis in the filePlease confirm if I whould edit it
BridgeAR commentedon Nov 26, 2019
@sarthak0906 it is covered by
TERM='xterm-256'. So there's no need to add another entry. Thanks a lot for checking your term settings!tty: truecolor check moved before 256 check
tty: truecolor check moved before 256 check
tty: truecolor check moved before 256 check
tty: truecolor check moved before 256 check
Edu93Jer commentedon Dec 26, 2020
Hi @BridgeAR a question, is this issue still open? I've seen that the last comment or commit referencing this issue was like a year ago, I am new to open source and I know is nothing about coding, but would like to at least contribute with something.
Or do you know if there's a good new issue to work with?
Mesteery commentedon Aug 10, 2021
Yes, this issue is resolved by #30474.