pub struct Theme {
pub name: String,
pub palette: ThemePalette,
pub typography: Typography,
pub spacing: SpacingScale,
pub base_styles: HashMap<String, StyleProperties>,
pub extends: Option<String>,
}Expand description
Theme definition containing all visual properties
Fields§
§name: String§palette: ThemePalette§typography: Typography§spacing: SpacingScale§base_styles: HashMap<String, StyleProperties>Default styles per widget type
extends: Option<String>Parent theme for inheritance
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn validate(&self, _allow_partial: bool) -> Result<(), String>
pub fn validate(&self, _allow_partial: bool) -> Result<(), String>
Validate theme with detailed error messages
Returns an error if:
- Palette colors are invalid or missing
- Typography values are invalid
- Spacing unit is non-positive
For themes with inheritance, validates only set colors For themes without inheritance, validates all required colors
Sourcepub fn validate_inheritance(
&self,
all_themes: &HashMap<String, Theme>,
visited: &mut Vec<String>,
) -> Result<(), ThemeError>
pub fn validate_inheritance( &self, all_themes: &HashMap<String, Theme>, visited: &mut Vec<String>, ) -> Result<(), ThemeError>
Validate theme inheritance
Returns an error if:
- Parent theme doesn’t exist
- Circular inheritance detected
- Inheritance depth exceeds 5 levels
Sourcepub fn inherit_from(&self, parent: &Theme) -> Self
pub fn inherit_from(&self, parent: &Theme) -> Self
Inherit properties from a parent theme
The child theme’s values take precedence, but missing values are inherited from the parent theme.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Theme
impl<'de> Deserialize<'de> for Theme
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
impl StructuralPartialEq for Theme
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnwindSafe for Theme
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