Set and check COLORTERM as a hint for RGB colour.

This commit is contained in:
nicm
2025-10-30 11:52:25 +00:00
parent 1e61e52400
commit 29db8ac36e
2 changed files with 18 additions and 0 deletions

View File

@@ -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);