Repository navigation
fix(client): map purple, brightPurple and selection to the terminal's theme keys - #43
Merged
Merged
Conversation
… 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>
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The client passed the config
themestraight to ghostty-web, which readsmagenta,brightMagenta,selectionBackgroundandselectionForeground. webtty'spurple,brightPurpleandselectionwere silently ignored, so magenta text stayed at ghostty-web's default#bc3fbcand 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:toTerminalThemetranslatespurple→magenta,brightPurple→brightMagenta,selection→selectionBackground, dropspadding(it colours the page, not the terminal) and passes other keys through.theme.selectionForeground; defaults tobackgroundwhenselectionis set, otherwise ghostty-web's defaults are untouched.purpleorselectionwill now show the colour it wrote.Testing
bun run lintclean,bun test: 425 pass (6 new tests insrc/client/theme.test.ts).🤖 Generated with Claude Code