From fda4aa21a1d29acf3c74ea82dace740120b1a387 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 4 Dec 2022 20:51:41 +0530 Subject: [PATCH] When drawing the tab bar have the default left and right margins drawn in a color matching the neighboring tab Fixes #5719 --- docs/changelog.rst | 2 ++ kitty/options/definition.py | 3 ++- kitty/tab_bar.py | 8 ++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index a6173f1e4..411558d79 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -59,6 +59,8 @@ Detailed list of changes - A new option :opt:`tab_title_max_length` to limit the length of tab (:iss:`5718`) +- When drawing the tab bar have the default left and right margins drawn in a color matching the neighboring tab (:iss:`5719`) + 0.26.5 [2022-11-07] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 3b1238007..b7c56c922 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -1248,7 +1248,8 @@ opt('tab_bar_margin_color', 'none', option_type='to_color_or_none', ctype='color_or_none_as_int', long_text=''' Color for the tab bar margin area. Defaults to using the terminal background -color. +color for margins above and below the tab bar. For side margins the default color +is chosen to match the background color of the neighboring tab. ''' ) egr() # }}} diff --git a/kitty/tab_bar.py b/kitty/tab_bar.py index d87dea831..61616d062 100644 --- a/kitty/tab_bar.py +++ b/kitty/tab_bar.py @@ -575,10 +575,14 @@ class TabBar: if opts.tab_bar_margin_height.inner: blank_rects.append(Border(0, tab_bar.bottom + 1, vw, central.top, bg)) g = self.window_geometry + left_bg = right_bg = bg + if opts.tab_bar_margin_color is None: + left_bg = BorderColor.tab_bar_left_edge_color + right_bg = BorderColor.tab_bar_right_edge_color if g.left > 0: - blank_rects.append(Border(0, g.top, g.left, g.bottom + 1, bg)) + blank_rects.append(Border(0, g.top, g.left, g.bottom + 1, left_bg)) if g.right - 1 < vw: - blank_rects.append(Border(g.right - 1, g.top, vw, g.bottom + 1, bg)) + blank_rects.append(Border(g.right - 1, g.top, vw, g.bottom + 1, right_bg)) self.blank_rects = tuple(blank_rects) def layout(self) -> None: