mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
Add mode 2031 support to automatically report dark or light theme. tmux
will guess the theme from the background colour on terminals which do not themselves support the escape sequence. Written by Jonathan Slenders, GitHub issue 4353.
This commit is contained in:
20
format.c
20
format.c
@ -1544,6 +1544,23 @@ format_cb_client_written(struct format_tree *ft)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Callback for client_theme. */
|
||||
static void *
|
||||
format_cb_client_theme(struct format_tree *ft)
|
||||
{
|
||||
if (ft->c != NULL) {
|
||||
switch (ft->c->theme) {
|
||||
case THEME_DARK:
|
||||
return (xstrdup("dark"));
|
||||
case THEME_LIGHT:
|
||||
return (xstrdup("light"));
|
||||
case THEME_UNKNOWN:
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Callback for config_files. */
|
||||
static void *
|
||||
format_cb_config_files(__unused struct format_tree *ft)
|
||||
@ -2877,6 +2894,9 @@ static const struct format_table_entry format_table[] = {
|
||||
{ "client_termtype", FORMAT_TABLE_STRING,
|
||||
format_cb_client_termtype
|
||||
},
|
||||
{ "client_theme", FORMAT_TABLE_STRING,
|
||||
format_cb_client_theme
|
||||
},
|
||||
{ "client_tty", FORMAT_TABLE_STRING,
|
||||
format_cb_client_tty
|
||||
},
|
||||
|
Reference in New Issue
Block a user