Add a self-contained theme editor example#146
Conversation
Greptile SummaryThis PR adds a self-contained The code is well-structured and the previously flagged issues (breadcrumb separator width measurement, One remaining issue was identified:
Confidence Score: 4/5Safe to merge after fixing the one P1 active-theme persistence bug in Three previously flagged P1s have been addressed. One new P1 remains:
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([run]) --> B[ThemeStore::load]
B --> C[run_simple_editor\nPaletteEditorState]
C --> |"e / enter"| D[edit_palette_slot\npick_color_with_picker]
C --> |"s"| E[save_palette_state\nstore.save ✓]
C --> |"t"| F[select_theme_from_simple\nstore.active_theme updated\nstore.save ✗ BUG]
C --> |"n"| G[create_theme_from_simple\nstate.dirty = true]
C --> |"d"| H[delete_theme_from_simple\nstore.save ✓]
C --> |"a"| I[run_advanced_hub]
C --> |"p"| J[preview_palette\nterm.stderr]
C --> |"v"| K[run_live_demo\nreal demand widgets]
C --> |"q / esc"| L{confirm_discard_if_dirty?}
L --> |dirty=false| M([exit])
L --> |dirty=true| N[Confirm discard]
N --> M
I --> |"Select active theme"| O[select_active_theme\nstore.save ✓]
I --> |"Create new"| P[create_theme → edit_theme_loop\nstore.save ✓]
I --> |"Edit custom"| Q[edit_custom_theme\nstore.save ✓]
I --> |"Delete"| R[delete_custom_theme\nstore.save ✓]
I --> |"Export"| S[export_active_theme\nfs::write]
I --> |"Import"| T[import_theme\nstore.save ✓]
style F fill:#f99,stroke:#c00
Reviews (3): Last reviewed commit: "Fix preview border width calculation" | Re-trigger Greptile |
|
Amazing example! Thanks for your contribution. |
Summary
This adds a self-contained
theme_editorexample that usesdemandto build an interactive theme editing workflow fordemanditself.The goal is to provide a practical showcase example that is also useful on its own for exploring and tuning theme values.
What changed
examples/theme_editor.rsWhy this is isolated
This PR does not change the library API or core prompt behavior.
All of the functionality lives in an example, so the review surface is limited to:
That makes it easier to evaluate as an additive showcase without taking on risk in the main library.
Why this example is useful
It demonstrates a more realistic
demandapplication than the smaller examples by combining:It also gives users a concrete way to understand how the built-in theme fields affect real UI output.
Validation
cargo check --example theme_editor