diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-02 10:20:08 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-02 10:20:08 -0400 |
| commit | 82b195278b551839314edf1bfab37d5f54c432cb (patch) | |
| tree | 181e6aae830e63048c919525c583dc156e058c05 /modules/ai-term-backend-eat.el | |
| parent | 4b53b52507faef662a8f670b4b80cbe24290de95 (diff) | |
| download | dotemacs-82b195278b551839314edf1bfab37d5f54c432cb.tar.gz dotemacs-82b195278b551839314edf1bfab37d5f54c432cb.zip | |
feat(ai-term): render Claude Code session colors in dupre hues
Claude Code's /color picks a session accent from eight names, each emitted as a fixed xterm-256 index (probed against v2.1.198 by cycling /color in a scratch tmux session and reading the SGR codes). Agent terminals now pin all eight indices plus the bypass banner to dupre faces, so any /color choice renders in the theme's palette instead of stock xterm hues. dupre has no orange or pink, so those borrow red+1 and magenta+1. If a Claude Code update moves an index, the stock hue comes back (the alist docstring carries the re-probe note).
Diffstat (limited to 'modules/ai-term-backend-eat.el')
| -rw-r--r-- | modules/ai-term-backend-eat.el | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/ai-term-backend-eat.el b/modules/ai-term-backend-eat.el index 82218ca7..21385e37 100644 --- a/modules/ai-term-backend-eat.el +++ b/modules/ai-term-backend-eat.el @@ -30,7 +30,7 @@ (defvar eat-buffer-name) (defvar eat-semi-char-mode-map) (defvar eat-terminal) -(defvar cj/ai-term-accent-color-indices) +(defvar cj/ai-term-palette-faces) (defun cj/--ai-term-send-string (buffer string) "Send STRING to BUFFER's terminal process (the agent's shell). @@ -40,20 +40,20 @@ Sends to the pty directly so the launch command reaches the shell EAT runs." (process-send-string proc string)))) (defun cj/--ai-term-apply-accent (buffer) - "Point BUFFER's terminal accent palette entries at `cj/ai-term-accent'. -Repaints each index in `cj/ai-term-accent-color-indices' in this -terminal's own 256-color palette (eat keeps one per terminal), so the -agent's accent -- Claude Code's rose banner, borders, spinner -- renders -in the accent face's color while every other eat terminal keeps the true -palette. A no-op when BUFFER has no live eat terminal. Takes effect on -the terminal's next redraw; text already on screen keeps its old color -until the program repaints it (Claude Code's TUI repaints continuously)." + "Point BUFFER's terminal palette entries at their dupre faces. +Repaints each (INDEX . FACE) in `cj/ai-term-palette-faces' in this +terminal's own 256-color palette (eat keeps one per terminal), so Claude +Code's accents -- the bypass banner and every /color session color -- +render in dupre hues while other eat terminals keep the true palette. +A no-op when BUFFER has no live eat terminal. Takes effect on the +terminal's next redraw; text already on screen keeps its old color until +the program repaints it (Claude Code's TUI repaints continuously)." (with-current-buffer buffer (when (bound-and-true-p eat-terminal) - (dolist (index cj/ai-term-accent-color-indices) + (dolist (entry cj/ai-term-palette-faces) (eat-term-set-parameter eat-terminal - (intern (format "color-%d-face" index)) - 'cj/ai-term-accent))))) + (intern (format "color-%d-face" (car entry))) + (cdr entry)))))) (defun cj/--ai-term-show-or-create (dir name) "Show or create the AI-term buffer for project DIR with buffer NAME. |
