Skip to content

fix(client): map purple, brightPurple and selection to the terminal's theme keys - #43

Merged
jesse23 merged 1 commit into
mainfrom
fix/client-theme-keys
Sep 21, 2026
Merged

jesse23 merged 1 commit into
mainfrom
fix/client-theme-keys

Conversation

@jesse23

@jesse23 jesse23 commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Problem

The client passed the config theme straight to ghostty-web, which reads magenta, brightMagenta, selectionBackground and selectionForeground. webtty's purple, brightPurple and selection were silently ignored, so magenta text stayed at ghostty-web's default #bc3fbc and the selection stayed light gray with dark text, whatever the config said. The same herdr session looked different in webtty than in Ghostty, which reads the palette as written.

Change

  • src/client/theme.ts: toTerminalTheme translates purple → magenta, brightPurple → brightMagenta, selection → selectionBackground, drops padding (it colours the page, not the terminal) and passes other keys through.
  • New optional theme.selectionForeground; defaults to background when selection is set, otherwise ghostty-web's defaults are untouched.
  • Config key names are unchanged, so existing config files keep working. A config that sets purple or selection will now show the colour it wrote.
  • ADR 036, client and config SPECs updated.

Testing

  • bun run lint clean, bun test: 425 pass (6 new tests in src/client/theme.test.ts).
  • Checked live in herdr next to Ghostty with the same config: purple text and selection now match.

🤖 Generated with Claude Code

… theme keys

The client passed the config theme straight to ghostty-web, which reads
magenta, brightMagenta and selectionBackground, so purple and selection were
silently ignored. Translate them in one place (ADR 036), and add
selectionForeground (defaults to background when selection is set).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation matches the documented decision and has focused coverage for its mapping and fallback behavior.

Review effort: Balanced
Findings: None

What changed in this PR

Maps webtty theme keys to ghostty-web’s expected keys while preserving existing configuration compatibility.

Changes:

  • Adds centralized theme translation and selection foreground behavior.
  • Adds focused mapping tests.
  • Updates configuration specs and records ADR 036.
File Description
src/​config.ts Adds selectionForeground configuration.
src/​client/​theme.ts Implements terminal theme mapping.
src/​client/​theme.test.ts Tests mapping and defaults.
src/​client/​index.ts Applies mapped theme during initialization.
docs/​specs/​config.md Documents selection colors.
docs/​specs/​client.md Records client mapping behavior.
docs/​adrs/​036.client.theme-key-mapping.md Documents the architectural decision.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jesse23
jesse23 merged commit f178be8 into main Sep 21, 2026
4 checks passed
@jesse23
jesse23 deleted the fix/client-theme-keys branch September 21, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants