docs/internal/theme-consolidation-plan.md
Currently, built-in themes in Fresh are defined in two ways: some are hardcoded in Rust source code (src/view/theme.rs), while others are loaded from JSON files. This creates a "split-brain" problem where the source of truth is divided, making maintenance difficult and leading to inconsistencies (e.g., the Theme Editor plugin not seeing Rust-defined themes).
This plan outlines a holistic approach to unify theme management.
All built-in themes (Dark, Light, High Contrast, Nostalgia) will be moved to JSON files in the themes/ directory.
themes/*.jsoninclude_str! in Rust to embed these JSON files directly into the binary.To ensure that JSON themes stay in sync with the ThemeFile structure defined in Rust:
ThemeFile struct.Theme schema but fails to update the JSON files, the CI test will fail.The Plugin API will be updated to allow plugins (like the Theme Editor) to discover built-in themes without needing to scan the filesystem.
getBuiltinThemes() will return a list of available built-in theme names and their JSON content (or a way to fetch the content).themes/ folder alongside the binary, as all built-in themes are part of the binary itself.dark, light, high-contrast, nostalgia) into themes/*.json files.ThemeFile schema.include_str! for each theme in src/view/theme.rs.Theme::dark(), Theme::light(), etc., with logic that loads from the embedded JSON.test_builtin_themes_match_schema test.plugins/theme_editor.ts to use the new discovery mechanism.