MaterialDynamicPalette
struct · ferroui-themes-material · v0.5.0
struct MaterialDynamicPalette
All five Android tonal palettes, including the full neutral and neutral-variant ranges. The Android 31–33 mapping deliberately uses neutral-variant surfaces, as AndroidX does, rather than the older system's lower-chroma neutral palette.
Members
primarysecondarytertiaryneutralneutral_variantfrom_android31_colorsfrom_seedfrom_seed_with_specpalettescheme_android31
primary
primary: MaterialTonalPalette
secondary
secondary: MaterialTonalPalette
tertiary
tertiary: MaterialTonalPalette
neutral
neutral: MaterialTonalPalette
neutral_variant
neutral_variant: MaterialTonalPalette
from_android31_colors
fn from_android31_colors(resolve: impl FnMut(MaterialPaletteFamily, u8) -> Option<Color>) -> Result<Self, MaterialDynamicColorError>
Imports the complete AndroidX tonal palette. A platform bridge supplies
the system tones and the additional neutral tones calculated by AndroidX
Color.setLuminance; values are never regenerated on this path.
from_seed
fn from_seed(seed: Color, style: MaterialPaletteStyle) -> Self
Generates five full HCT palettes locally. To reproduce a device wallpaper scheme exactly, import its system palettes or direct color roles instead.
from_seed_with_spec
fn from_seed_with_spec(seed: Color, style: MaterialPaletteStyle, dark: bool, source_spec: MaterialColorSpec) -> Self
Generates all five tone palettes for a source specification. In the 2025 phone spec some palette chromas depend on dark mode, so it is explicit.
palette
fn palette(self: &Self, family: MaterialPaletteFamily) -> &MaterialTonalPalette
scheme_android31
fn scheme_android31(self: &Self, dark: bool) -> Result<MaterialColorScheme, MaterialDynamicColorError>
Exact role selection from dynamicLightColorScheme31 /
dynamicDarkColorScheme31 in the pinned AndroidX source. Fixed roles do
not change with light/dark mode. Error roles retain the AndroidX defaults.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherEquivalent<K>CastableFrom<ST, Uninit, Uninit>CastableFrom<ST, Initialized, Initialized>Read<Exclusive, BecauseExclusive>CloneDebugStructuralPartialEqPartialEqEq
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.