kitty: give active ssh tabs the same foreground as every other tab

__kitty_tab_set sent a luminance-picked black/white active_fg, so a
tinted tab's title looked different from a normal one. Send NONE
instead: tab_fg() then falls back to the shared active foreground (the
theme background) while active_bg keeps the per-host tint.

Covered by a new case in tests/test_tab_bar_colors.py matching what
__kitty_tab_set actually sends — host background, no fg override.
This commit is contained in:
Anton Volnuhin 2026-08-06 01:35:25 +03:00
parent 31d3048abe
commit f66ee4d845
2 changed files with 10 additions and 3 deletions

View File

@ -99,6 +99,13 @@ for theme_bg in (0xF8F8F8, 0x1C2836):
(as_rgb(HOST_FG), as_rgb(HOST_BG)),
"active tab takes the host color",
),
(
# What __kitty_tab_set actually sends: host background, no fg
# override, so the shared active foreground applies.
TabBarData("tab", is_active=True, active_bg=HOST_BG),
(as_rgb(theme_bg), as_rgb(HOST_BG)),
"active tab without an fg override keeps the shared foreground",
),
(
TabBarData("tab", is_active=False, inactive_fg=HOST_BG),
(as_rgb(HOST_BG), as_rgb(theme_bg)),

View File

@ -15,11 +15,11 @@ function __kitty_tab_set -d "Tint the current kitty tab for the given ssh/mosh h
end
end
set -l bg (string split ' ' $colors)[1]
set -l fg (string split ' ' $colors)[2]
# Active tab: full host-color background, readable fg.
# Active tab: full host-color background, and NONE for the foreground so it
# falls back to the same one every other active tab uses.
# Inactive tab: keep theme's dark background (NONE), host color as text only.
kitten @ set-tab-color "active_bg=$bg" "active_fg=$fg" \
kitten @ set-tab-color "active_bg=$bg" active_fg=NONE \
"inactive_bg=NONE" "inactive_fg=$bg" 2>/dev/null
kitten @ set-tab-title "$host" 2>/dev/null
end