FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    MaterialColorScheme

    struct · ferroui-themes-material · v0.5.0

    struct MaterialColorScheme
    

    View source

    Members

    new

    const fn new(colors: [Color; 48]) -> Self
    

    All roles are required, in MaterialColorRole::ALL order.

    Source

    color

    fn color(self: &Self, role: MaterialColorRole) -> Color
    

    Source

    set_color

    fn set_color(self: &mut Self, role: MaterialColorRole, color: Color)
    

    Source

    with_color

    fn with_color(self: Self, role: MaterialColorRole, color: Color) -> Self
    

    Source

    light

    const fn light() -> Self
    

    Source

    dark

    const fn dark() -> Self
    

    Source

    expressive_light

    const fn expressive_light() -> Self
    

    Native MaterialExpressiveTheme light baseline, including its four tone-30 container foregrounds.

    Source

    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.

    Source

    resources

    fn resources(self: &Self) -> Ref<ResourceDictionary>
    

    A fresh dictionary permits atomic replacement: no frame observes half a palette.

    Source

    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.

    Source

    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].

    Source

    from_seed_with_options

    fn from_seed_with_options(seed: Color, options: MaterialDynamicColorOptions) -> Result<Self, MaterialDynamicColorError>
    

    Source

    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.

    Source

    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.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • Equivalent<K>
    • CastableFrom<ST, Uninit, Uninit>
    • CastableFrom<ST, Initialized, Initialized>
    • Read<Exclusive, BecauseExclusive>
    • Clone
    • Debug
    • StructuralPartialEq
    • PartialEq
    • Eq
    • Default

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.