mirror of
https://github.com/tmux/tmux.git
synced 2025-11-25 03:26:05 +00:00
Set and check COLORTERM as a hint for RGB colour.
This commit is contained in:
@@ -262,6 +262,12 @@ environ_for_session(struct session *s, int no_TERM)
|
||||
environ_set(env, "TERM", 0, "%s", value);
|
||||
environ_set(env, "TERM_PROGRAM", 0, "%s", "tmux");
|
||||
environ_set(env, "TERM_PROGRAM_VERSION", 0, "%s", getversion());
|
||||
environ_set(env, "COLORTERM", 0, "truecolor");
|
||||
} else {
|
||||
environ_unset(env, "TERM");
|
||||
environ_unset(env, "TERM_PROGRAM");
|
||||
environ_unset(env, "TERM_PROGRAM_VERSION");
|
||||
environ_unset(env, "COLORTERM");
|
||||
}
|
||||
|
||||
if (s != NULL)
|
||||
|
||||
12
tty-term.c
12
tty-term.c
@@ -532,6 +532,7 @@ tty_term_create(struct tty *tty, char *name, char **caps, u_int ncaps,
|
||||
size_t offset, namelen;
|
||||
char *first;
|
||||
int n;
|
||||
struct environ_entry *envent;
|
||||
|
||||
log_debug("adding term %s", name);
|
||||
|
||||
@@ -595,6 +596,17 @@ tty_term_create(struct tty *tty, char *name, char **caps, u_int ncaps,
|
||||
a = options_array_next(a);
|
||||
}
|
||||
|
||||
/* Check for COLORTERM. */
|
||||
envent = environ_find(tty->client->environ, "COLORTERM");
|
||||
if (envent != NULL) {
|
||||
log_debug("%s COLORTERM=%s", tty->client->name, envent->value);
|
||||
if (strcasecmp(envent->value, "truecolor") == 0 ||
|
||||
strcasecmp(envent->value, "24bit") == 0)
|
||||
tty_add_features(feat, "RGB", ",");
|
||||
else if (strstr(s, "256") != NULL)
|
||||
tty_add_features(feat, "256", ",");
|
||||
}
|
||||
|
||||
/* Apply overrides so any capabilities used for features are changed. */
|
||||
tty_term_apply_overrides(term);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user