Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supports-colors.js - additional terminals to detect #42

Open
dse opened this issue Apr 14, 2023 · 1 comment
Open

supports-colors.js - additional terminals to detect #42

dse opened this issue Apr 14, 2023 · 1 comment

Comments

@dse
Copy link

dse commented Apr 14, 2023

Other TERM values you may wish to look for:

  • mintty, mintty-direct, etc.
  • vt220, vt340, vt420, vt525, etc.
  • tmux

Example patch:

     return 2;
   }
 
-  if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
+  if (/^screen|^tmux|^xterm|^vt[1-5][0-9][0-9]|^rxvt|mintty|color|ansi|cygwin|linux/i.test(env.TERM)) {
     return 1;
   }

On any modern Linux distro (or whatever) with a reasonly up-to-date terminfo database, you should be able to get a complete list of VT100+ style TERM values via:

#!/usr/bin/env bash
toe -a | cut -f1 | while read term ; do
    if infocmp "$term" | grep -q -e 'bold=[^, ]*\E\[1m' -e 'sgr0=[^, ]*\E\[0?m' ; then
        echo "$term"
    fi
done

You probably needn't do them all, just the ones that look like they'll be reasonably common. And not all of them support color, though all should support reverse video, bold, underline, etc.

@webdiscus
Copy link

@dse,

thank you!
I have implemented your patch to detect additional terminals in other colorize lib - ansis.

prisis added a commit to visulima/visulima that referenced this issue Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants