From 39d52fbbcfeae42419fe9f78d6d9b46df9691073 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sun, 9 Aug 2026 12:53:03 +0100 Subject: [PATCH 1/2] Record verified light-mode results for the theme hooks Tested with the system actually in light mode rather than inferred from dark: - the status bar switches in the same second client-light-theme fires - a fresh nvim reports background=light, so the OSC 11 round trip through tmux to ghostty works and restarting nvim is genuinely sufficient - delta resolves syntax-theme = GitHub, its light default, against Monokai Extended on dark, so it does detect the terminal background Both the nvim and delta checks needed a real tty to be meaningful. Run with stdout on a pipe they each fall back to their dark default, which looks like a correct answer while proving nothing. Also documents why the first Light switch did not move the status bar: tmux enables the terminal's theme-reporting mode when a client attaches, so the client that predated these hooks was never asked to report changes. A detach and reattach fixes it, and a fresh server never sees it. Co-Authored-By: Claude Opus 5 (1M context) --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ff64126..0cb8c9b 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,19 @@ toggling Light/Dark by hand — nothing in the chain knows why it changed. > [!NOTE] > A running nvim will not follow a live change: the docs are explicit that the > TUI sets `background` *on startup* if it can detect it. New instances are -> fine; existing ones need `:set background=light` or a restart. delta is -> per-invocation so should be fine, but that is untested here. +> fine — verified, a fresh nvim in light mode reports `background=light` — but +> existing ones need `:set background=light` or a restart. + +Verified in light mode: the status bar switches in the same second the hook +fires, a fresh nvim detects `light`, and delta resolves its light default +(`syntax-theme = GitHub`, against `Monokai Extended` on dark). + +> [!TIP] +> When adding these hooks to an *already running* tmux server, detach and +> reattach. tmux enables the terminal’s theme-reporting mode when a client +> attaches, so a client that predates the hooks never gets asked to report +> changes — `#{client_theme}` still reads correctly, because that is answered by +> a direct query, but no hook fires until the client reattaches. > [!NOTE] > This previously used [`dark-mode-notify`](https://github.com/bouk/dark-mode-notify) From d012a7f23ea6ca3ae22f63eb5696afcec7576ff6 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sun, 9 Aug 2026 14:02:01 +0100 Subject: [PATCH 2/2] Make the Claude Code statusline follow the terminal palette MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nine colours were hardcoded One Dark RGB via 38;2;R;G;B, so they did not follow the light/dark switch. Measured against the tangere backgrounds they are fine on dark (4.25-10.80:1) but collapse on light: orange 1.78, amber 1.70, yellow 1.63, and 'white' — used for the token total — at 1.35:1, effectively invisible. Switched to palette indices, which resolve through the terminal's own palette and so follow the ghostty tangere-light/tangere-dark swap with no detection and no cost per render. 'white' becomes 39, default foreground, since it means primary text. All seven colours actually used get distinct indices; blue and yellow are unreferenced but converted too, so no RGB is left behind. Contrast now clears WCAG AA in both modes: 5.77-14.26:1 on dark, 6.32-20.61:1 on light. Trade-off: tangere has no orange and its palette 2 is teal rather than green, so 'green' reads teal and the warm colours sit closer together than the One Dark originals did. Co-Authored-By: Claude Opus 5 (1M context) --- claude/statusline.isaacaudet.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/claude/statusline.isaacaudet.sh b/claude/statusline.isaacaudet.sh index f2c3b2a..5981116 100755 --- a/claude/statusline.isaacaudet.sh +++ b/claude/statusline.isaacaudet.sh @@ -37,15 +37,22 @@ input=$(cat) mkdir -p /tmp/claude # ===== Colors ===== -blue='\033[38;2;97;175;239m' -orange='\033[38;2;255;176;85m' -amber='\033[38;2;229;192;123m' -green='\033[38;2;80;200;120m' -cyan='\033[38;2;86;182;194m' -red='\033[38;2;235;87;87m' -yellow='\033[38;2;230;200;0m' -white='\033[38;2;220;220;220m' -magenta='\033[38;2;198;120;221m' +# Palette indices rather than RGB, so these resolve through the terminal's own +# palette and follow the ghostty tangere-light/tangere-dark swap for free. No +# appearance detection, so no cost per statusline render. +# +# The previous values were One Dark RGB: fine on dark (4.3-10.8:1) but 1.35-3.4:1 +# on a light background, with 'white' effectively invisible. These clear WCAG AA +# in both modes (5.8-14.3:1 on dark, 6.3-20.6:1 on light). +blue='\033[38;5;4m' +orange='\033[38;5;3m' +amber='\033[38;5;11m' +green='\033[38;5;2m' +cyan='\033[38;5;14m' +red='\033[38;5;1m' +yellow='\033[38;5;3m' +white='\033[39m' +magenta='\033[38;5;5m' dim='\033[2m' reset='\033[0m'