MaterialColorScheme
struct · ferroui-themes-material · v0.5.0
struct MaterialColorScheme
Members
newcolorset_colorwith_colorlightdarkexpressive_lightstatus_colorresourcesfrom_seedfrom_seed_colorfrom_seed_with_optionsfrom_seed_with_specfrom_android_system_roles
new
const fn new(colors: [Color; 48]) -> Self
All roles are required, in MaterialColorRole::ALL order.
color
fn color(self: &Self, role: MaterialColorRole) -> Color
set_color
fn set_color(self: &mut Self, role: MaterialColorRole, color: Color)
with_color
fn with_color(self: Self, role: MaterialColorRole, color: Color) -> Self
light
const fn light() -> Self
dark
const fn dark() -> Self
expressive_light
const fn expressive_light() -> Self
Native MaterialExpressiveTheme light baseline, including its four tone-30 container foregrounds.
status_color
fn status_color(self: &Self, status: MaterialStatusColor) -> Color
A status color: of the light palette for a light surface, of the dark one for a dark surface.
resources
fn resources(self: &Self) -> Ref<ResourceDictionary>
A fresh dictionary permits atomic replacement: no frame observes half a palette.
from_seed
fn from_seed(seed: Color, dark: bool) -> Self
Standard-contrast Tonal Spot scheme, generated with CAM16/HCT. Seed alpha is ignored, matching the opaque source-color contract of Material utilities.
from_seed_color
fn from_seed_color(seed: Color, dark: bool, contrast_level: f64) -> Result<Self, MaterialDynamicColorError>
Generates all 48 roles, including fixed and surface-container roles, with the Tonal Spot palette and an explicit contrast level in [-1, 1].
from_seed_with_options
fn from_seed_with_options(seed: Color, options: MaterialDynamicColorOptions) -> Result<Self, MaterialDynamicColorError>
from_seed_with_spec
fn from_seed_with_spec(seed: Color, options: MaterialDynamicColorOptions, source_spec: MaterialColorSpec) -> Result<Self, MaterialDynamicColorError>
Generates all 48 roles using an explicit source specification and its
official phone-variant fallback. Spec2025 enables the current expressive
palettes, chroma-sensitive surfaces, and independent tone constraints.
from_android_system_roles
fn from_android_system_roles(dark: bool, resolve: impl FnMut(MaterialColorRole) -> Option<Color>) -> Result<Self, MaterialDynamicColorError>
Losslessly imports Android 14/API 34+ roles, including system high-contrast
adjustments. The host resolves the corresponding mc3_light_scheme or
mc3_dark_scheme attributes. As in AndroidX, error roles and scrim retain
their baseline defaults when absent; supplied overrides are preserved.
Every other role is required. This method does not query Android or JNI.
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>CloneDebugStructuralPartialEqPartialEqEqDefault
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.