kitty: keep the tab bar on the terminal background

Catppuccin Latte sets tab_bar_background #BCC0CC, a grey noticeably
darker than its #EFF1F5 background, so in light mode the tab bar sat on
a band of its own colour. kitty.conf leaves the setting commented out --
kitty's default is to follow the terminal background -- but the
generated *-theme.auto.conf files are applied with priority over
kitty.conf, so the theme won and there was nowhere left to override it.

repair-auto-themes.sh already normalises macos_titlebar_color for the
same reason; give tab_bar_background the same treatment. The canonical
copies under theme-modes stay exactly as the themes kitten saved them.

Also picks up the current theme choices: SpaceGray Eighties for dark,
Catppuccin Latte for light.
This commit is contained in:
Anton Volnuhin 2026-08-06 14:34:19 +03:00
parent ccf4a18c86
commit 8c9e5e2c99
5 changed files with 186 additions and 94 deletions

View File

@ -2,6 +2,22 @@
set -eu set -eu
# Settings the generated theme files must carry whatever theme was saved into
# them. kitty applies <appearance>-theme.auto.conf after -- and with priority
# over -- kitty.conf, so a theme naming one of these wins and there is nowhere
# else left to say otherwise:
#
# macos_titlebar_color background titlebar follows the theme's background
# tab_bar_background none tab bar uses the terminal background,
# kitty's default and what kitty.conf asks
# for; Catppuccin Latte and others pin a
# contrasting grey, which leaves the tab
# bar a visibly different colour from the
# window it sits above
#
# The canonical copies in ./theme-modes stay exactly as the themes kitten wrote
# them; only these generated files are normalised.
# Permission bits of a file, or 600 if they cannot be read. GNU stat spells this # Permission bits of a file, or 600 if they cannot be read. GNU stat spells this
# `-c %a` while BSD/macOS spells it `-f %Lp`, and each mis-parses the other's # `-c %a` while BSD/macOS spells it `-f %Lp`, and each mis-parses the other's
# form -- GNU treats `-f` as --file-system and prints a block of filesystem info # form -- GNU treats `-f` as --file-system and prints a block of filesystem info
@ -18,27 +34,37 @@ file_mode() {
printf '600\n' printf '600\n'
} }
# The theme with those settings stripped and re-appended in a fixed form.
# Trailing blank lines go too, so running this over its own output reproduces it
# byte for byte and repeated repairs cannot make the file grow.
normalised() {
awk '
$1 == "macos_titlebar_color" || $1 == "tab_bar_background" { next }
{ line[++n] = $0 }
END {
while (n > 0 && line[n] ~ /^[ \t]*$/) n--
for (i = 1; i <= n; i++) print line[i]
}
' "$1"
printf '\nmacos_titlebar_color background\ntab_bar_background none\n'
}
config_dir=${1:-"$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"} config_dir=${1:-"$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"}
for appearance in dark light no-preference; do for appearance in dark light no-preference; do
config_file="$config_dir/$appearance-theme.auto.conf" config_file="$config_dir/$appearance-theme.auto.conf"
[ -f "$config_file" ] || continue [ -f "$config_file" ] || continue
if awk '
$1 == "macos_titlebar_color" {
count++
if ($2 == "background") correct++
}
END { exit !(count == 1 && correct == 1) }
' "$config_file"; then
continue
fi
tmp=$(mktemp "$config_file.tmp.XXXXXX") tmp=$(mktemp "$config_file.tmp.XXXXXX")
trap 'rm -f "$tmp"' EXIT HUP INT TERM trap 'rm -f "$tmp"' EXIT HUP INT TERM
awk '$1 != "macos_titlebar_color"' "$config_file" > "$tmp"
printf '\nmacos_titlebar_color background\n' >> "$tmp" normalised "$config_file" > "$tmp"
if cmp -s "$tmp" "$config_file"; then
rm -f "$tmp"
else
chmod "$(file_mode "$config_file")" "$tmp" chmod "$(file_mode "$config_file")" "$tmp"
mv -f "$tmp" "$config_file" mv -f "$tmp" "$config_file"
fi
trap - EXIT HUP INT TERM trap - EXIT HUP INT TERM
done done

View File

@ -21,7 +21,13 @@ if options.macos_titlebar_color != 1:
f"{sys.argv[2]} automatic Kitty theme does not use its background " f"{sys.argv[2]} automatic Kitty theme does not use its background "
"for the macOS titlebar" "for the macOS titlebar"
) )
if options.tab_bar_background is not None:
raise SystemExit(
f"{sys.argv[2]} automatic Kitty theme pins its own tab bar background "
f"({options.tab_bar_background!r}) instead of following the terminal "
"background"
)
' "$config_file" "$appearance" ' "$config_file" "$appearance"
done done
echo "ok - automatic Kitty themes match their macOS titlebars" echo "ok - automatic Kitty themes match their macOS titlebars and tab bars"

View File

@ -148,6 +148,46 @@ expect "adoption is idempotent (dark)" \
expect "adoption is idempotent (light)" \ expect "adoption is idempotent (light)" \
"$config_dir/theme-modes/light.conf" "$BYPASS_LIGHT" "$config_dir/theme-modes/light.conf" "$BYPASS_LIGHT"
# --- a theme that pins its own tab bar background is neutralised ----------
# kitty applies these generated files with priority over kitty.conf, so a theme
# like Catppuccin Latte that sets tab_bar_background leaves the tab bar a
# different colour from the window and kitty.conf cannot override it.
echo auto >"$config_dir/theme-mode"
printf 'background %s\ntab_bar_background #bcc0cc\n' "$LIGHT" \
>"$config_dir/theme-modes/light.conf"
"$root/apply-theme-mode.sh" "$config_dir"
tab_bar_lines() {
grep -c '^tab_bar_background' "$1" || true
}
[ "$(awk '$1 == "tab_bar_background" { print $2 }' \
"$config_dir/light-theme.auto.conf")" = none ] || {
echo "not ok - generated theme keeps the theme's own tab bar background" >&2
exit 1
}
[ "$(tab_bar_lines "$config_dir/light-theme.auto.conf")" -eq 1 ] || {
echo "not ok - generated theme has more than one tab_bar_background" >&2
exit 1
}
grep -q '#bcc0cc' "$config_dir/theme-modes/light.conf" || {
echo "not ok - the canonical copy should keep the theme as it was saved" >&2
exit 1
}
# repairing twice must not append a second copy or grow the file
before=$(wc -c <"$config_dir/light-theme.auto.conf")
"$root/apply-theme-mode.sh" "$config_dir"
[ "$(wc -c <"$config_dir/light-theme.auto.conf")" -eq "$before" ] || {
echo "not ok - repeated repair grows the generated theme" >&2
exit 1
}
expect "the theme itself still applies" \
"$config_dir/light-theme.auto.conf" "$LIGHT"
printf 'background %s\nmacos_titlebar_color background\n' "$LIGHT" \
>"$config_dir/theme-modes/light.conf"
# --- a bare `theme` records auto when it lands on the macOS appearance ---- # --- a bare `theme` records auto when it lands on the macOS appearance ----
echo auto >"$config_dir/theme-mode" echo auto >"$config_dir/theme-mode"
"$root/apply-theme-mode.sh" "$config_dir" "$root/apply-theme-mode.sh" "$config_dir"

View File

@ -1,29 +1,29 @@
background #090200 background #212121
foreground #a4a1a1 foreground #bdb9ae
cursor #a4a1a1 cursor #bbbbbb
selection_background #494542 selection_background #262e35
color0 #090200 color0 #15171c
color8 #5b5754 color8 #545454
color1 #da2c20 color1 #ec5f67
color9 #e8bacf color9 #ff6973
color2 #00a152 color2 #80a763
color10 #3a3332 color10 #93d393
color3 #fcec02 color3 #fdc253
color11 #494542 color11 #ffd156
color4 #00a0e4 color4 #5485c0
color12 #7f7c7b color12 #4d83d0
color5 #a06994 color5 #bf83c0
color13 #d6d4d3 color13 #ff55ff
color6 #b5e4f4 color6 #57c2c0
color14 #ccab53 color14 #83e8e4
color7 #a4a1a1 color7 #eeece7
color15 #f7f7f7 color15 #ffffff
selection_foreground #090200 selection_foreground #212121
# START_AUTOGENERATED_TAB_STYLE # START_AUTOGENERATED_TAB_STYLE
# Feel free to update these colors manually and remove these comments. # Feel free to update these colors manually and remove these comments.
active_tab_foreground #eeeeee active_tab_foreground #eeeeee
active_tab_background #494542 active_tab_background #262e35
inactive_tab_foreground #a4a1a1 inactive_tab_foreground #bdb9ae
inactive_tab_background #070200 inactive_tab_background #1a1a1a
# END_AUTOGENERATED_TAB_STYLE # END_AUTOGENERATED_TAB_STYLE

View File

@ -1,60 +1,80 @@
## name: GrokDay # vim:ft=kitty
## author: xAI (grok build), ported by Anton
## license: see https://github.com/xai-org/grok-build
## upstream: https://github.com/xai-org/grok-build/blob/main/crates/codegen/xai-grok-pager-render/src/theme/grokday.rs
## blurb: The GrokDay theme from grok build's TUI: light counterpart with deepened accents.
# GrokDay — neutral light gray base with deepened accents. ## name: Catppuccin-Latte
# ## author: Pocco81 (https://github.com/Pocco81)
# Ported from grok build's TUI theme: ## license: MIT
# xai-org/grok-build ## upstream: https://github.com/catppuccin/kitty/blob/main/themes/latte.conf
# crates/codegen/xai-grok-pager-render/src/theme/grokday.rs ## blurb: Soothing pastel theme for the high-spirited!
#
# Light counterpart to GrokNight: same hue family, darkened for contrast on a
# light background. background is grok's bg_base, the surface the TUI actually
# paints; bg_terminal (#f5f5f5) is for terminal-output blocks and is unused.
# cursor is accent_user, which grok itself sets over OSC 12 on startup.
background #eeeeee
foreground #262626
cursor #444444
cursor_text_color #eeeeee
selection_background #c6c6c6
selection_foreground #262626
url_color #2f64d2
# black — text_primary / dark5
color0 #262626
color8 #626262
# red — red1 / red
color1 #af2323
color9 #cd3048
# green — green / green1
color2 #378e23
color10 #0c947c
# yellow — yellow / orange
color3 #a27612
color11 #c3691e
# blue — blue0 / blue
color4 #28448a
color12 #2f64d2
# magenta — purple / magenta (grok's signature accent)
color5 #6c3eb2
color13 #7d4bc6
# cyan — teal / cyan
color6 #0a8e70
color14 #0082aa
# white — fg_gutter / bg (the palette's brightest; bg_storm is now the
# background itself, so it would be invisible here)
color7 #b2b2b2
color15 #f5f5f5
# START_AUTOGENERATED_TAB_STYLE # The basic colors
# Feel free to update these colors manually and remove these comments. foreground #4C4F69
active_tab_foreground #f5f5f5 background #EFF1F5
active_tab_background #7d4bc6 selection_foreground #EFF1F5
inactive_tab_foreground #7d4bc6 selection_background #DC8A78
inactive_tab_background #f5f5f5
# END_AUTOGENERATED_TAB_STYLE
macos_titlebar_color background # Cursor colors
cursor #DC8A78
cursor_text_color #EFF1F5
# URL underline color when hovering with mouse
url_color #DC8A78
# Kitty window border colors
active_border_color #7287FD
inactive_border_color #9CA0B0
bell_border_color #DF8E1D
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #EFF1F5
active_tab_background #8839EF
inactive_tab_foreground #4C4F69
inactive_tab_background #9CA0B0
tab_bar_background #BCC0CC
# Colors for marks (marked text in the terminal)
mark1_foreground #EFF1F5
mark1_background #7287fD
mark2_foreground #EFF1F5
mark2_background #8839EF
mark3_foreground #EFF1F5
mark3_background #209FB5
# The 16 terminal colors
# black
color0 #5C5F77
color8 #6C6F85
# red
color1 #D20F39
color9 #D20F39
# green
color2 #40A02B
color10 #40A02B
# yellow
color3 #DF8E1D
color11 #DF8E1D
# blue
color4 #1E66F5
color12 #1E66F5
# magenta
color5 #EA76CB
color13 #EA76CB
# cyan
color6 #179299
color14 #179299
# white
color7 #ACB0BE
color15 #BCC0CC