Add ThemeDefinition and ProviderColors types to litmus-model (litmus-jmna)
Add new types to litmus-model alongside the existing Theme struct (don’t remove it yet):
ThemeDefinition: name, variant (dark/light), slug, providers (HashMap<String, String>)ProviderColors: provider slug, source_version, all 22 color fields (same as current Theme colors)- TOML deserialization for both:
.tomlfor definitions,.{provider}.tomlfor provider colors - Loader function that scans a themes directory and returns
Vec<ThemeDefinition>+HashMap<(slug, provider), ProviderColors>
Keep the old Theme struct and parsers intact — they’ll be removed in a later task after consumers migrate.
Plan
New file: crates/litmus-model/src/provider.rs
Variantenum (Dark/Light) with serde lowercaseThemeDefinitionstruct: name, variant, slug (derived from filename), providers HashMapProviderColorsstruct: provider slug, source_version, same color fields as Theme- TOML parsing for both types (reuse existing parse_field pattern)
load_themes_dir()function: scan directory, return Vec+ HashMap<(String, String), ProviderColors>
Test-first approach
- Write tests for Variant serde, ThemeDefinition parsing, ProviderColors parsing, and loader function
- Then implement to make them pass
Commits
- Tests commit (failing)
- Implementation commit
Summary of Changes
Added provider module to litmus-model with:
Variantenum (Dark/Light) with lowercase serdeThemeDefinitionstruct: name, variant, slug (from filename), providers HashMap<String, String>ProviderColorsstruct: provider slug, source_version, all 21 color fields matching Theme- TOML parsing for both types via
parse_theme_definition()andparse_provider_colors() load_themes_dir()recursive directory loader returning Vec+ HashMap<(slug, provider), ProviderColors> - Shared
parse_hex_color()helper extracted to lib.rs, reused across toml_format and provider modules - Filename/TOML provider validation in the loader
- 20 tests covering parsing, serde, edge cases, directory loading, error propagation
Old Theme struct left intact as specified.