Open
Conversation
Enable runtime theme changes via `terminal.options.theme = newTheme`
without restarting the terminal. All existing content re-renders
instantly with the new colors.
- Add `ghostty_terminal_set_colors` WASM export that updates terminal
colors and forces a full redraw
- Wire up `handleOptionChange('theme')` to merge partial themes,
update the renderer, and sync WASM terminal colors
- Support partial theme updates that accumulate (e.g. setting only
background preserves all other colors)
- Cells with ANSI palette/default colors re-resolve; explicit RGB
cells remain unchanged
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
Resolves #125 |
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.
Summary
ghostty_terminal_set_colorsWASM export that updates terminal colors at runtime and forces a full redrawterminal.options.theme = newThemeto merge partial themes, update the renderer, and sync WASM terminal colorsbackgroundpreserves all other colors)Usage
Changes
patches/ghostty-wasm-api.patchsetColors()Zig function,force_full_redrawflag onTerminalWrapper, render state reset on color changeghostty-vt.wasmghostty_terminal_set_colorsexportlib/types.tsghostty_terminal_set_colorsto WASM exports interfacelib/ghostty.tssetColors()method toGhosttyTerminalclasslib/terminal.tshandleOptionChange('theme')now merges, updates renderer + WASM; addedcurrentThemeaccumulator andbuildThemeColorsConfig()helperlib/terminal.test.tsTest plan
null/undefined/{}restores defaultsopen()is applied correctlyneedsFullRedraw()returns true)bun run typecheck && bun testpass (343 tests, 0 failures)🤖 Generated with Claude Code