Skip to main content

Crate gpui_material_theme

Crate gpui_material_theme 

Source
Expand description

Material 3 theme values for a host toolkit.

The caller owns the theme and supplies current window metrics and system preferences.

Structs§

Argb
A packed 8-bit sRGB color in alpha, red, green, blue order.
ColorPair
Resolved foreground and background colors for a Material pairing.
ColorScheme
All semantic color roles for one appearance, with per-role overrides.
CubicBezier
The two control points of a cubic Bézier easing from (0, 0) to (1, 1).
CustomColorGroup
Resolved Material 3 four-role custom color group for one appearance.
FontFamilies
Family preference and ordered fallback for one typeface.
LayoutPolicy
Pure layout inputs. Widths and geometry are already in logical units.
MaterialTheme
Application-owned configuration consumed by the Material rendering layer.
Spring
Material spring parameters for unit mass.
TypeStyle
Material type metrics in scale-independent units (sp).
Typography
Family names for the Material scale. The host resolves available fonts and measures the resulting text.

Enums§

Appearance
The selected appearance. The host resolves any system preference.
ColorRole
Semantic Material color roles.
CornerRole
Semantic Material 3 corner-radius scale tokens.
CornerShape
Logical rounded corners in top-start, top-end, bottom-end, bottom-start order.
Density
Desktop density adjustment for a component’s visual size.
Direction
Logical horizontal reading and layout direction.
DynamicVariant
The Material dynamic color palette to derive from a seed.
Elevation
The six Material elevation levels. The renderer supplies the shadow.
MaterialShape
Named Material 3 Expressive shapes matching pinned Compose MaterialShapes.
MotionKind
Spatial springs move or reshape an element. Effects springs drive properties such as color and opacity and use critical damping.
MotionScheme
Standard and Expressive schemes from the fixed Material 3 reference.
MotionSpec
Resolved animation timing specification for a state transition.
MotionSpeed
Relative speed tier for a Material motion token.
PolygonRole
Basic semantic polygon tokens bundled in tokens/material.json.
PolygonSpec
Inputs for the finite rounded polygons used as morph endpoints. These are source coordinates before path generation and normalization.
SpecVersion
The requested Material Color Utilities specification.
StateLayer
Material state layer opacities.
ThemePreset
Bundled palette recipes, with seed colors inspired by md3.io.
TokenValue
The typed value of a token from the bundled data. Semantic color roles resolve through the current ColorScheme.
TypeRole
One of the fifteen Material text roles.
Typeface
The two Material typeface families.
TypographyEmphasis
Emphasis tier for Material 3 Expressive typography.
WidthClass
Material window width classes, based on available logical width.

Functions§

contrast_ratio_of_tones
Returns the contrast ratio for two CIE L* tones, clamped to 0 through 100. Returns None if either tone is NaN.
harmonize_color
Shifts design’s hue toward source using Material Color Utilities harmonization. Input alpha channels are ignored and the returned color is opaque.
token
Looks up an exact, case-sensitive token name from the bundled Material data.