mirror of
https://github.com/tmux/tmux.git
synced 2026-10-13 14:24:28 +00:00
Report the terminal's own theme to panes rather than guessing from the
background. GitHub issue 5343 from Ayman Bagabas.
This commit is contained in:
18
window.c
18
window.c
@@ -2412,7 +2412,6 @@ window_pane_get_theme(struct window_pane *wp)
|
|||||||
{
|
{
|
||||||
struct window *w;
|
struct window *w;
|
||||||
struct client *loop;
|
struct client *loop;
|
||||||
enum client_theme theme;
|
|
||||||
int found_light = 0, found_dark = 0;
|
int found_light = 0, found_dark = 0;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
@@ -2420,14 +2419,9 @@ window_pane_get_theme(struct window_pane *wp)
|
|||||||
w = wp->window;
|
w = wp->window;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Derive theme from pane background color, if it's not the default
|
* Prefer a theme reported by an attached client with mode 2031 or DSR
|
||||||
* colour.
|
* 996: the terminal knows its own light or dark mode.
|
||||||
*/
|
*/
|
||||||
theme = colour_totheme(window_pane_get_bg(wp));
|
|
||||||
if (theme != THEME_UNKNOWN)
|
|
||||||
return (theme);
|
|
||||||
|
|
||||||
/* Try to find a client that has a theme. */
|
|
||||||
TAILQ_FOREACH(loop, &clients, entry) {
|
TAILQ_FOREACH(loop, &clients, entry) {
|
||||||
if (loop->flags & CLIENT_UNATTACHEDFLAGS)
|
if (loop->flags & CLIENT_UNATTACHEDFLAGS)
|
||||||
continue;
|
continue;
|
||||||
@@ -2444,12 +2438,16 @@ window_pane_get_theme(struct window_pane *wp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found_dark && !found_light)
|
if (found_dark && !found_light)
|
||||||
return (THEME_DARK);
|
return (THEME_DARK);
|
||||||
if (found_light && !found_dark)
|
if (found_light && !found_dark)
|
||||||
return (THEME_LIGHT);
|
return (THEME_LIGHT);
|
||||||
return (THEME_UNKNOWN);
|
|
||||||
|
/*
|
||||||
|
* Otherwise guess from the pane background colour, for terminals which
|
||||||
|
* do not report a theme themselves.
|
||||||
|
*/
|
||||||
|
return (colour_totheme(window_pane_get_bg(wp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user