mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Look for setrgbf and setrgbb terminfo extensions for RGB colour. This is
the most reasonable of the various (some bizarre) suggestions for capabilities.
This commit is contained in:
20
tty-term.c
20
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:
|
||||
@ -576,6 +590,12 @@ tty_term_string2(struct tty_term *term, enum tty_code_code code, int a, int b)
|
||||
return (tparm((char *) tty_term_string(term, code), a, 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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user