pub struct Theme { /* private fields */ }Expand description
A theme: cascade of CSS rules resolved into concrete styles by element.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn default_theme() -> Theme
pub fn default_theme() -> Theme
The default theme: built-in CSS styles.
Sourcepub fn parse(css: &str) -> Result<Theme, StyleError>
pub fn parse(css: &str) -> Result<Theme, StyleError>
Parse a user stylesheet and overlay it onto the default theme. Later rules override earlier rules for the same element.
Sourcepub fn declared(&self, e: Element) -> &Declared
pub fn declared(&self, e: Element) -> &Declared
The declared properties for an element, as merged from all matching rules.
Sourcepub fn base(&self) -> TextStyle
pub fn base(&self) -> TextStyle
The base text style for the theme: hard fallback overlaid by body element declarations.
Sourcepub fn margin(&self, e: Element) -> Edges
pub fn margin(&self, e: Element) -> Edges
The margin edges for an element. Unset sides default to 0.0.
Sourcepub fn padding(&self, e: Element) -> Edges
pub fn padding(&self, e: Element) -> Edges
The padding edges for an element. Unset sides default to 0.0.
Sourcepub fn background(&self, e: Element) -> Option<Color>
pub fn background(&self, e: Element) -> Option<Color>
The background color for an element, if set.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin 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