colors.js
colors.js copied to clipboard
supports-colors.js - additional terminals to detect
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.
@dse,
thank you! I have implemented your patch to detect additional terminals in other colorize lib - ansis.