Expand description
Design-token crate: the Theme aggregate and its token-group tables
(color, typography, shape, elevation, motion, glass, status), plus the
ThemeBuilder and ThemeExtensions seams a design system composes
its own token set through.
No design language lives here. The one baseline this crate constructs
is Theme::neutral — the language-free floor
every shell falls back to when nothing was installed. Material, Cupertino,
and Glyph each ship as their own plugin crate (frust-material,
frust-cupertino, frust-glyph), building their tables over the same
public constructors and attaching whatever they need through
ThemeExtensions. A DesignLanguage tag records which system
assembled a Theme; it never selects behaviour here.
This crate is deliberately pure data + constructors — no
frust-scene, no reactive_graph. It depends on peniko (for
peniko::Color, reused by color::ColorScheme), frust-text (for
frust_text::TextStyle, reused by typography::TypeScale), and
frust-core (for the PaintCtx/LayoutCtx recovery helpers alone) — see
docs/ARCHITECTURE.md’s Layer Dependencies.
Every token table below carries its own source URL and retrieval date in its module’s doc comments.
Re-exports§
pub use builder::ThemeBuilder;pub use color::Brightness;pub use color::ColorScheme;pub use elevation::Elevation;pub use elevation::ElevationLevel;pub use elevation::ShadowSpec;pub use elevation::SurfaceRole;pub use extensions::ThemeExtensions;pub use glass::GlassFill;pub use glass::GlassMaterial;pub use glass::GlassScale;pub use motion::CosmeticLoopRate;pub use motion::EasingSet;pub use motion::MotionDurations;pub use motion::MotionScheme;pub use motion::MotionSpring;pub use shape::ShapeScale;pub use status::StatusColors;pub use status::StatusPalette;pub use theme::DesignLanguage;pub use theme::Theme;pub use typefaces::FontFace;pub use typefaces::NativeTypefaces;pub use typography::TypeScale;
Modules§
- builder
ThemeBuilder: thedefineTheme/copyWithanalog for composing aThemefrom a baseline plus layered edits.- color
- Color roles:
ColorScheme(46 roles) and theBrightnessacrate::theme::Themeselects one by. - elevation
Elevation::neutral: the design-language-free 6-level (0-5) elevation table, each level a dp value, a v1 shadow mapping, and the surface-container role a surface at that level should paint with.- extensions
ThemeExtensions: the no-lock-in typed extension slotcrate::theme::Themecarries (a FlutterThemeExtensionanalog).- glass
- Glass material tokens: a three-tier
GlassScale(chrome/bar/control), each carrying aGlassMaterialrecipe — background-blur intent, translucent fill washes for over-light and over-dark content, a specular hairline alpha, and a dropShadowSpec. - motion
MotionScheme::neutral: the design-language-free motion scheme — six spring presets plus a duration/easing token vocabulary, replacing a plain duration+easing-only model.- shape
ShapeScale::neutral: the design-language-free 10 corner-radius tokens (post-Expressive scale shape).- status
StatusPalette: success/warning/info color roles as acrate::extensions::ThemeExtensionsconsumer.- theme
Theme: the aggregate design-token bundle an app wires through to its widget tree. The value is delivered two ways: to app code through the reactive context (use_context::<Theme>()via the facade), and to widgets through the type-erasedPaintCtx/LayoutCtxtheme slot — theTheme::from_paint_ctx/Theme::from_layout_ctxwrappers below recover it in one line.- typefaces
NativeTypefaces: the native-control typeface binding a design system attaches as acrate::extensions::ThemeExtensionspayload.- typography
TypeScale::neutral: the design-language-free type-scale progression — 15 namedfrust_text::TextStylepresets plus 15_emphasizedsiblings (see “Emphasized type scale” below).