summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorTim Ruffing <crypto@timruffing.de>2021-11-11 07:14:57 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-11 07:14:57 +0100
commitf30f53115928fd65d066944d53d07742b0807670 (patch)
tree89b054324753f26dfe155ed15071081fe64ca562 /src/term.c
parent894dd18804ef766a87ffa4b4109125b4661651be (diff)
downloademacs-f30f53115928fd65d066944d53d07742b0807670.tar.gz
Support Tc terminfo flag for 24-bit color support in terminal
* src/term.c (init_tty): Use the Tc flag (bug#44950). Copyright-paperwork-exempt: yes
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/term.c b/src/term.c
index 6f0b827cfc8..d86ae12ba84 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4152,10 +4152,12 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\
could return 32767. */
tty->TN_max_colors = 16777216;
}
- /* Fall back to xterm+direct (semicolon version) if requested
- by the COLORTERM environment variable. */
- else if ((bg = getenv("COLORTERM")) != NULL
- && strcasecmp(bg, "truecolor") == 0)
+ /* Fall back to xterm+direct (semicolon version) if Tc is set
+ (de-facto standard introduced by tmux) or if requested by
+ the COLORTERM environment variable. */
+ else if (tigetflag("Tc")
+ || ((bg = getenv("COLORTERM")) != NULL
+ && strcasecmp(bg, "truecolor") == 0))
{
tty->TS_set_foreground = "\033[%?%p1%{8}%<%t3%p1%d%e38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m";
tty->TS_set_background = "\033[%?%p1%{8}%<%t4%p1%d%e48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m";