feat(theme): custom theme editor foundation#17
Open
noahbclarkson wants to merge 10 commits intomainfrom
Open
Conversation
noahbclarkson
pushed a commit
that referenced
this pull request
Apr 19, 2026
Enables the Theme Editor UI to read Hsla values back from a serialized theme and edit them as hex strings. The function: - Converts HSL to RGB using the standard algorithm - Outputs #RRGGBB for fully-opaque colors (a=1.0) - Outputs #RRGGBBAA for transparent colors (a<1.0) - Preserves Catppuccin Mocha and other built-in themes through roundtrip 7 new tests covering pure colors, transparency, black, white, and roundtrip on real theme data. Ref: PR #17
noahbclarkson
pushed a commit
that referenced
this pull request
Apr 20, 2026
Enables the Theme Editor UI to read Hsla values back from a serialized theme and edit them as hex strings. The function: - Converts HSL to RGB using the standard algorithm - Outputs #RRGGBB for fully-opaque colors (a=1.0) - Outputs #RRGGBBAA for transparent colors (a<1.0) - Preserves Catppuccin Mocha and other built-in themes through roundtrip 7 new tests covering pure colors, transparency, black, white, and roundtrip on real theme data. Ref: PR #17
1f74d59 to
b619b8d
Compare
…eState Foundation for custom theme editor UI. - Add Serialize to Theme and Appearance (with lowercase rename) - ThemeState: add set_active_theme() and insert_theme() methods - json_theme: add serialize_theme_to_json() and save_theme_to_file() - 2 new roundtrip tests: serialize produces valid JSON, serialize→deserialize roundtrip Hsla serializes to #rrggbbaa hex (8-char), compatible with hex_to_hsla loader.
Enables the Theme Editor UI to read Hsla values back from a serialized theme and edit them as hex strings. The function: - Converts HSL to RGB using the standard algorithm - Outputs #RRGGBB for fully-opaque colors (a=1.0) - Outputs #RRGGBBAA for transparent colors (a<1.0) - Preserves Catppuccin Mocha and other built-in themes through roundtrip 7 new tests covering pure colors, transparency, black, white, and roundtrip on real theme data. Ref: PR #17
…ditor_dialog - Fix closure type inference in build_color_fields and build_status_fields using explicit type annotations with fn pointer types - Add ColorFieldSpec and StatusFieldSpec type aliases for complex types - Fix needless_borrow clippy warnings on hex_val and text - Remove unused StyledText and TextInputEvent imports - Fix parse_hex_or_default to accept &str directly - Add missing lifetime parameters to type aliases Build: cargo build ✓ cargo test --workspace ✓ cargo clippy ✓
Previously the event was emitting self.editable_theme (the pre-save theme) instead of new_theme (the actually-saved theme with updated colors). Although no current subscriber depends on this, the event contract should reflect the actual saved state.
Without this, if a user keeps the dialog open and edits a second color field before saving again, the second save would start from the original theme values rather than the just-saved state, causing the first edit to be silently lost.
Add Ctrl+Shift+T / Alt+9 to open theme editor directly: - CommandId::OpenThemeEditor in command_palette enum - as_str, display_label, TryFrom for OpenThemeEditor - PaletteCommand entry with Ctrl+Shift+T shortcut - Workspace command handler for OpenThemeEditor - key_handler: Escape dismisses editor, Ctrl+Shift+T / Alt+9 opens it - any_overlay_active blocks panel shortcuts when editor is open
Add Alt+8 (stashes) and Ctrl+Shift+T / Alt+9 (theme editor) to the shortcuts help overlay under the Panels section.
- Default visible=false so the editor no longer appears on workspace launch. - Pre-populate inputs with the current hex via set_text instead of only set_placeholder. Empty inputs previously caused save() to pass "" to hex_to_hsla, which returned black and reset every visible field. - save() now skips empty inputs and keeps the current theme value. - Preview swatches fall back to the current theme color when the typed text is empty or malformed, rather than flashing to black. - Clear save_status when the dialog is reopened, and render it in the footer (success or error) so the user gets feedback and sees the saved file path. - Remove the dead "cmd+enter" branch from the key handler; keystroke.key holds just the key name, never a modifier combination. - Tidy up redundant parentheses around setter calls. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
b619b8d to
27b5126
Compare
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
Foundation for a custom theme editor UI. This PR adds:
Format notes
What's NOT included (next PRs)
Tests
CI
CI will run on this PR. Draft until UI work is complete.