aboutsummaryrefslogtreecommitdiff
path: root/tty-term.c
diff options
context:
space:
mode:
Diffstat (limited to 'tty-term.c')
-rw-r--r--tty-term.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tty-term.c b/tty-term.c
index d1142ad2..38829bdd 100644
--- a/tty-term.c
+++ b/tty-term.c
@@ -242,6 +242,8 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_SE] = { TTYCODE_STRING, "Se" },
[TTYC_SETAB] = { TTYCODE_STRING, "setab" },
[TTYC_SETAF] = { TTYCODE_STRING, "setaf" },
+ [TTYC_SETRGBB] = { TTYCODE_STRING, "setrgbb" },
+ [TTYC_SETRGBF] = { TTYCODE_STRING, "setrgbf" },
[TTYC_SGR0] = { TTYCODE_STRING, "sgr0" },
[TTYC_SITM] = { TTYCODE_STRING, "sitm" },
[TTYC_SMACS] = { TTYCODE_STRING, "smacs" },
@@ -521,6 +523,18 @@ tty_term_find(char *name, int fd, char **cause)
code->type = TTYCODE_STRING;
}
+ /* On terminals with RGB colour (TC), fill in setrgbf and setrgbb. */
+ if (tty_term_flag(term, TTYC_TC) &&
+ !tty_term_has(term, TTYC_SETRGBF) &&
+ !tty_term_has(term, TTYC_SETRGBB)) {
+ code = &term->codes[TTYC_SETRGBF];
+ code->value.string = xstrdup("\033[38;2;%p1%d;%p2%d;%p3%dm");
+ code->type = TTYCODE_STRING;
+ code = &term->codes[TTYC_SETRGBB];
+ code->value.string = xstrdup("\033[48;2;%p1%d;%p2%d;%p3%dm");
+ code->type = TTYCODE_STRING;
+ }
+
return (term);
error:
@@ -577,6 +591,12 @@ tty_term_string2(struct tty_term *term, enum tty_code_code code, int a, int b)
}
const char *
+tty_term_string3(struct tty_term *term, enum tty_code_code code, int a, int b, int c)
+{
+ return (tparm((char *) tty_term_string(term, code), a, b, c));
+}
+
+const char *
tty_term_ptr1(struct tty_term *term, enum tty_code_code code, const void *a)
{
return (tparm((char *) tty_term_string(term, code), a));