Cygwin: console: support 24 bit color

- Add 24 bit color support using xterm compatibility mode in
  Windows 10 1703 or later.
- Add fake 24 bit color support for legacy console, which uses
  the nearest color from 16 system colors.
This commit is contained in:
Takashi Yano
2019-04-01 00:47:46 +09:00
committed by Corinna Vinschen
parent 7b8049f7a3
commit bd627864ab
6 changed files with 227 additions and 34 deletions

View File

@@ -869,7 +869,8 @@ win32env_to_cygenv (PWCHAR rawenv, bool posify)
char *newp;
int i;
int sawTERM = 0;
static char NO_COPY cygterm[] = "TERM=cygwin";
const char cygterm[] = "TERM=cygwin";
const char xterm[] = "TERM=xterm-256color";
char *tmpbuf = tp.t_get ();
PWCHAR w;
@@ -899,8 +900,10 @@ win32env_to_cygenv (PWCHAR rawenv, bool posify)
debug_printf ("%p: %s", envp[i], envp[i]);
}
/* If console has 24 bit color capability, TERM=xterm-256color,
otherwise, TERM=cygwin */
if (!sawTERM)
envp[i++] = strdup (cygterm);
envp[i++] = strdup (wincap.has_con_24bit_colors () ? xterm : cygterm);
envp[i] = NULL;
return envp;