pub struct Theme { /* private fields */ }Expand description
A fully resolved theme, ready to style widgets.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn solid(&self, expression: &str) -> Result<Rgb, String>
pub fn solid(&self, expression: &str) -> Result<Rgb, String>
Resolves a colour written the way theme files write it ("$danger", "#38BDF8",
"mix($accent, $danger, 50%)") against this theme’s tokens.
§Errors
A message explaining why expression is not a single colour: it does not parse, names an
unknown token, or uses pulse(), which breathes and so has no single colour.
Sourcepub fn series_color(&self, index: usize) -> Rgb
pub fn series_color(&self, index: usize) -> Rgb
The tone of the index-th series of a chart, counted from zero.
A theme carries SERIES_COLORS series tones, so the tones wrap around: series five takes
the tone of series zero. Wrapping is why a chart must name its series with a
Legend instead of leaving the meaning in the colour, and why a
chart that needs more than five kinds is better off grouping the small ones together.
Sourcepub fn typography(&self, role: &str) -> Option<&StyleProps>
pub fn typography(&self, role: &str) -> Option<&StyleProps>
A typography role such as "title".
Sourcepub fn icon_overrides(&self) -> &BTreeMap<String, IconGlyphs>
pub fn icon_overrides(&self) -> &BTreeMap<String, IconGlyphs>
Icons this theme overrides on top of its icon set.
Sourcepub fn animation_overrides(&self) -> &BTreeMap<String, Arc<CellAnimation>>
pub fn animation_overrides(&self) -> &BTreeMap<String, Arc<CellAnimation>>
Animations this theme defines or replaces on top of its icon set’s.
Sourcepub fn style(
&self,
widget: &str,
variant: Option<&str>,
states: &[State],
) -> StyleProps
pub fn style( &self, widget: &str, variant: Option<&str>, states: &[State], ) -> StyleProps
The style of widget drawn with variant in states: every matching rule layered
from least to most specific.
The result is remembered for the lifetime of the theme, so asking again (as widgets do every frame) is a lookup, and the returned properties share their storage.
Trait Implementations§
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more