pub struct ThemeBuilder { /* private fields */ }Expand description
A layered builder over a Theme baseline — see the module docs for the
full precedence order. Every method takes/returns Self by value so calls
chain (Theme::builder(base).colors_dark(..).map_shape(..).build()).
Implementations§
Source§impl ThemeBuilder
impl ThemeBuilder
Sourcepub fn new(base: Theme) -> Self
pub fn new(base: Theme) -> Self
Start a builder from base — typically
Theme::neutral or a design system’s
own baseline, but any already-built Theme works (e.g. re-deriving
one theme from another).
Sourcepub fn colors_light(self, scheme: ColorScheme) -> Self
pub fn colors_light(self, scheme: ColorScheme) -> Self
Whole-group swap: replace the light ColorScheme outright.
Sourcepub fn map_colors_light(
self,
f: impl FnOnce(ColorScheme) -> ColorScheme,
) -> Self
pub fn map_colors_light( self, f: impl FnOnce(ColorScheme) -> ColorScheme, ) -> Self
Per-token closure edit: hand the current light ColorScheme to f,
keeping whatever fields it doesn’t overwrite (Rust struct-update ..
ergonomics).
Sourcepub fn colors_dark(self, scheme: ColorScheme) -> Self
pub fn colors_dark(self, scheme: ColorScheme) -> Self
Whole-group swap: replace the dark ColorScheme outright.
Sourcepub fn map_colors_dark(self, f: impl FnOnce(ColorScheme) -> ColorScheme) -> Self
pub fn map_colors_dark(self, f: impl FnOnce(ColorScheme) -> ColorScheme) -> Self
Per-token closure edit: hand the current dark ColorScheme to f.
Sourcepub fn type_scale(self, scale: TypeScale) -> Self
pub fn type_scale(self, scale: TypeScale) -> Self
Whole-group swap: replace the TypeScale outright.
Sourcepub fn map_type_scale(self, f: impl FnOnce(TypeScale) -> TypeScale) -> Self
pub fn map_type_scale(self, f: impl FnOnce(TypeScale) -> TypeScale) -> Self
Per-token closure edit: hand the current TypeScale to f.
Sourcepub fn shape(self, shape: ShapeScale) -> Self
pub fn shape(self, shape: ShapeScale) -> Self
Whole-group swap: replace the ShapeScale outright.
Sourcepub fn map_shape(self, f: impl FnOnce(ShapeScale) -> ShapeScale) -> Self
pub fn map_shape(self, f: impl FnOnce(ShapeScale) -> ShapeScale) -> Self
Per-token closure edit: hand the current ShapeScale to f.
Sourcepub fn elevation(self, elevation: Elevation) -> Self
pub fn elevation(self, elevation: Elevation) -> Self
Whole-group swap: replace the Elevation table outright.
Sourcepub fn map_elevation(self, f: impl FnOnce(Elevation) -> Elevation) -> Self
pub fn map_elevation(self, f: impl FnOnce(Elevation) -> Elevation) -> Self
Per-token closure edit: hand the current Elevation table to f.
Sourcepub fn motion(self, motion: MotionScheme) -> Self
pub fn motion(self, motion: MotionScheme) -> Self
Whole-group swap: replace the MotionScheme outright.
Sourcepub fn map_motion(self, f: impl FnOnce(MotionScheme) -> MotionScheme) -> Self
pub fn map_motion(self, f: impl FnOnce(MotionScheme) -> MotionScheme) -> Self
Per-token closure edit: hand the current MotionScheme to f.
Sourcepub fn glass(self, glass: GlassScale) -> Self
pub fn glass(self, glass: GlassScale) -> Self
Whole-group swap: replace the GlassScale outright.
Sourcepub fn map_glass(self, f: impl FnOnce(GlassScale) -> GlassScale) -> Self
pub fn map_glass(self, f: impl FnOnce(GlassScale) -> GlassScale) -> Self
Per-token closure edit: hand the current GlassScale to f.
Sourcepub fn brightness(self, brightness: Brightness) -> Self
pub fn brightness(self, brightness: Brightness) -> Self
Set the active Brightness (which of light/dark Theme::scheme
selects).
Sourcepub fn design_language(self, design_language: DesignLanguage) -> Self
pub fn design_language(self, design_language: DesignLanguage) -> Self
Set the DesignLanguage tag. Purely a tag (see
crate::theme::DesignLanguage’s docs) — this does not itself swap
any token group; pair it with the whole-group swaps above when
actually changing baselines.
Sourcepub fn extension<T: Any + Send + Sync>(self, ext: T) -> Self
pub fn extension<T: Any + Send + Sync>(self, ext: T) -> Self
Insert or replace a typed extension (see crate::extensions) —
replace-by-TypeId, same semantics as
ThemeExtensions::insert.