pub struct ThemeCatalog { /* private fields */ }Expand description
Theme index with embedded built-ins and optional custom documents. In-memory operations never read environment variables or access the filesystem.
Implementations§
Source§impl ThemeCatalog
impl ThemeCatalog
Sourcepub fn builtin() -> Result<ThemeCatalog, ThemeError>
pub fn builtin() -> Result<ThemeCatalog, ThemeError>
Create a catalog from embedded themes, without accessing disk or environment.
Sourcepub fn load() -> Result<ThemeCatalog, ThemeError>
pub fn load() -> Result<ThemeCatalog, ThemeError>
Load embedded themes, user themes, and the persisted native selection.
pub fn get(&self, id: &str) -> Option<&ThemeEntry>
pub fn iter(&self) -> impl Iterator<Item = (&str, &ThemeEntry)>
pub fn active_id(&self) -> &str
pub fn active_appearance(&self) -> Appearance
Sourcepub fn revision(&self) -> u64
pub fn revision(&self) -> u64
Stable within a process and sensitive to theme documents, selection, appearance, additions, and removals. Web adapters use this revision to publish change events without exposing filesystem paths.
Sourcepub fn export_family(&self, family: &str) -> Option<ThemePackDocument>
pub fn export_family(&self, family: &str) -> Option<ThemePackDocument>
Export every built-in and custom theme in a named family as one pack.
Sourcepub fn pack_conflicts(&self, pack: &ThemePackDocument) -> PackConflicts
pub fn pack_conflicts(&self, pack: &ThemePackDocument) -> PackConflicts
Report custom and built-in ID collisions without changing the catalog.
Sourcepub fn import_pack(
&mut self,
pack: ThemePackDocument,
policy: PackConflictPolicy,
) -> Result<PackImportReport, ThemeError>
pub fn import_pack( &mut self, pack: ThemePackDocument, policy: PackConflictPolicy, ) -> Result<PackImportReport, ThemeError>
Import a validated pack after resolving all ID collisions up front. Reject policy guarantees no writes occur if any ID conflicts.
Sourcepub fn import_pack_in_memory(
&mut self,
pack: ThemePackDocument,
policy: PackConflictPolicy,
) -> Result<PackImportReport, ThemeError>
pub fn import_pack_in_memory( &mut self, pack: ThemePackDocument, policy: PackConflictPolicy, ) -> Result<PackImportReport, ThemeError>
Import into memory. Validation and collision checks precede all mutations.
Sourcepub fn save(&mut self, document: ThemeDocument) -> Result<(), ThemeError>
pub fn save(&mut self, document: ThemeDocument) -> Result<(), ThemeError>
Save a portable custom theme to the shared user theme folder.
Sourcepub fn insert_custom(
&mut self,
document: ThemeDocument,
) -> Result<(), ThemeError>
pub fn insert_custom( &mut self, document: ThemeDocument, ) -> Result<(), ThemeError>
Insert or replace a custom theme without persisting it. Built-ins are protected.
pub fn select(&mut self, id: &str) -> Result<(), ThemeError>
Sourcepub fn set_active(&mut self, id: &str) -> Result<(), ThemeError>
pub fn set_active(&mut self, id: &str) -> Result<(), ThemeError>
Select a theme in memory without persisting it.
pub fn set_appearance( &mut self, appearance: Appearance, ) -> Result<(), ThemeError>
Sourcepub fn set_active_appearance(&mut self, appearance: Appearance)
pub fn set_active_appearance(&mut self, appearance: Appearance)
Change appearance in memory without persisting it.
pub fn remove_custom(&mut self, id: &str) -> Result<bool, ThemeError>
Sourcepub fn remove_custom_entry(&mut self, id: &str) -> Result<bool, ThemeError>
pub fn remove_custom_entry(&mut self, id: &str) -> Result<bool, ThemeError>
Remove a custom entry in memory, falling back to the embedded default if active.
Trait Implementations§
Source§impl Clone for ThemeCatalog
impl Clone for ThemeCatalog
Source§fn clone(&self) -> ThemeCatalog
fn clone(&self) -> ThemeCatalog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more