pub struct ThemeDocument {
pub themes: HashMap<String, Theme>,
pub default_theme: Option<String>,
pub follow_system: bool,
}Expand description
Root document for theme.dampen file
Fields§
§themes: HashMap<String, Theme>All defined themes (light, dark, custom, etc.)
default_theme: Option<String>Default theme name to use on startup If None, follows system preference
follow_system: boolWhether to auto-detect system dark/light mode
Implementations§
Source§impl ThemeDocument
impl ThemeDocument
Sourcepub fn validate(&self) -> Result<(), ThemeError>
pub fn validate(&self) -> Result<(), ThemeError>
Validate the document
Returns an error if:
- No themes are defined (THEME_001)
- Default theme is specified but doesn’t exist (THEME_002)
- Any theme fails validation
Sourcepub fn validate_inheritance(&self) -> Result<(), ThemeError>
pub fn validate_inheritance(&self) -> Result<(), ThemeError>
Validate inheritance for all themes
Returns an error if:
- Parent theme doesn’t exist (THEME_006)
- Circular inheritance detected (THEME_007)
- Inheritance depth exceeds 5 levels (THEME_008)
Sourcepub fn resolve_inheritance(&self) -> HashMap<String, Theme>
pub fn resolve_inheritance(&self) -> HashMap<String, Theme>
Resolve inheritance for all themes
Creates a new HashMap where each theme inherits from its parent. Themes without inheritance are copied as-is.
Sourcepub fn effective_default<'a>(
&'a self,
system_preference: Option<&'a str>,
) -> &'a str
pub fn effective_default<'a>( &'a self, system_preference: Option<&'a str>, ) -> &'a str
Get the effective default theme name
Priority: user_preference > default_theme > system_preference > “light”
Trait Implementations§
Source§impl Clone for ThemeDocument
impl Clone for ThemeDocument
Source§fn clone(&self) -> ThemeDocument
fn clone(&self) -> ThemeDocument
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThemeDocument
impl Debug for ThemeDocument
Source§impl<'de> Deserialize<'de> for ThemeDocument
impl<'de> Deserialize<'de> for ThemeDocument
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ThemeDocument
impl PartialEq for ThemeDocument
Source§impl Serialize for ThemeDocument
impl Serialize for ThemeDocument
impl StructuralPartialEq for ThemeDocument
Auto Trait Implementations§
impl Freeze for ThemeDocument
impl RefUnwindSafe for ThemeDocument
impl Send for ThemeDocument
impl Sync for ThemeDocument
impl Unpin for ThemeDocument
impl UnwindSafe for ThemeDocument
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more