From 41207aa830497c8e0784af620e1be354ac0e49b6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 7 Jan 2023 13:56:36 +0530 Subject: [PATCH] kitty @ get-colors: Report the current tab bar colors for the active OS window rather than configured values. Fixes #5865 --- kitty/rc/get_colors.py | 4 ++++ kitty/tab_bar.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/kitty/rc/get_colors.py b/kitty/rc/get_colors.py index 35076fb8c..ff421994b 100644 --- a/kitty/rc/get_colors.py +++ b/kitty/rc/get_colors.py @@ -51,6 +51,10 @@ configured colors. ans.pop(k, None) else: ans[k] = color_from_int(v) + tab = windows[0].tabref() + tm = None if tab is None else tab.tab_manager_ref() + if tm is not None: + ans.update(tm.tab_bar.current_colors) all_keys = natsort_ints(ans) maxlen = max(map(len, all_keys)) return '\n'.join(('{:%ds} {}' % maxlen).format(key, color_as_sharp(ans[key])) for key in all_keys) diff --git a/kitty/tab_bar.py b/kitty/tab_bar.py index 61616d062..210115a32 100644 --- a/kitty/tab_bar.py +++ b/kitty/tab_bar.py @@ -559,6 +559,16 @@ class TabBar: self.draw_data = self.draw_data._replace(inactive_fg=ifg) self.screen.color_profile.set_configured_colors(fg, bg) + @property + def current_colors(self) -> Dict[str, Color]: + return { + 'active_tab_foreground': self.draw_data.active_fg, + 'inactive_tab_foreground': self.draw_data.inactive_fg, + 'active_tab_background': self.draw_data.active_bg, + 'inactive_tab_background': self.draw_data.inactive_bg, + 'tab_bar_background': self.draw_data.default_bg, + } + def update_blank_rects(self, central: Region, tab_bar: Region, vw: int, vh: int) -> None: opts = get_options() blank_rects: List[Border] = []