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
Re-export core tailwind-rs functionality 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_color(&self, name: &str) -> Result<&Color, TailwindError>
pub fn get_color(&self, name: &str) -> Result<&Color, TailwindError>
Get a color from the theme
Sourcepub fn get_spacing(&self, name: &str) -> Result<&Spacing, TailwindError>
pub fn get_spacing(&self, name: &str) -> Result<&Spacing, TailwindError>
Get spacing from the theme
Sourcepub fn get_border_radius(
&self,
name: &str,
) -> Result<&BorderRadius, TailwindError>
pub fn get_border_radius( &self, name: &str, ) -> Result<&BorderRadius, TailwindError>
Get border radius from the theme
Sourcepub fn get_box_shadow(&self, name: &str) -> Result<&BoxShadow, TailwindError>
pub fn get_box_shadow(&self, name: &str) -> Result<&BoxShadow, TailwindError>
Get box shadow from the theme
Sourcepub fn get_custom(&self, name: &str) -> Result<&ThemeValue, TailwindError>
pub fn get_custom(&self, name: &str) -> Result<&ThemeValue, TailwindError>
Get custom value from the theme
Sourcepub fn validate(&self) -> Result<(), TailwindError>
pub fn validate(&self) -> Result<(), TailwindError>
Validate the theme
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Theme
impl<'de> Deserialize<'de> for Theme
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Theme, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Theme, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Theme
impl Serialize for Theme
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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