pub struct Theme {
pub name: String,
pub colors: HashMap<String, Color>,
pub spacing: HashMap<String, Spacing>,
pub border_radius: HashMap<String, BorderRadius>,
pub box_shadows: HashMap<String, BoxShadow>,
pub custom: HashMap<String, ThemeValue>,
}
Expand description
Main theme structure
Fields§
§name: String
§colors: HashMap<String, Color>
§spacing: HashMap<String, Spacing>
§border_radius: HashMap<String, BorderRadius>
§box_shadows: HashMap<String, BoxShadow>
§custom: HashMap<String, ThemeValue>
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn add_spacing(&mut self, name: impl Into<String>, spacing: Spacing)
pub fn add_spacing(&mut self, name: impl Into<String>, spacing: Spacing)
Add spacing to the theme
Sourcepub fn add_border_radius(
&mut self,
name: impl Into<String>,
radius: BorderRadius,
)
pub fn add_border_radius( &mut self, name: impl Into<String>, radius: BorderRadius, )
Add border radius to the theme
Sourcepub fn add_box_shadow(&mut self, name: impl Into<String>, shadow: BoxShadow)
pub fn add_box_shadow(&mut self, name: impl Into<String>, shadow: BoxShadow)
Add box shadow to the theme
Sourcepub fn add_custom(&mut self, name: impl Into<String>, value: ThemeValue)
pub fn add_custom(&mut self, name: impl Into<String>, value: ThemeValue)
Add custom value to the theme
Sourcepub fn get_spacing(&self, name: &str) -> Result<&Spacing>
pub fn get_spacing(&self, name: &str) -> Result<&Spacing>
Get spacing from the theme
Sourcepub fn get_border_radius(&self, name: &str) -> Result<&BorderRadius>
pub fn get_border_radius(&self, name: &str) -> Result<&BorderRadius>
Get border radius from the theme
Sourcepub fn get_box_shadow(&self, name: &str) -> Result<&BoxShadow>
pub fn get_box_shadow(&self, name: &str) -> Result<&BoxShadow>
Get box shadow from the theme
Sourcepub fn get_custom(&self, name: &str) -> Result<&ThemeValue>
pub fn get_custom(&self, name: &str) -> Result<&ThemeValue>
Get custom value from the 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