pub struct MaterialColorScheme {Show 50 fields
pub is_dark: bool,
pub primary: Color,
pub on_primary: Color,
pub primary_container: Color,
pub on_primary_container: Color,
pub secondary: Color,
pub on_secondary: Color,
pub secondary_container: Color,
pub on_secondary_container: Color,
pub tertiary: Color,
pub on_tertiary: Color,
pub tertiary_container: Color,
pub on_tertiary_container: Color,
pub error: Color,
pub on_error: Color,
pub error_container: Color,
pub on_error_container: Color,
pub background: Color,
pub on_background: Color,
pub surface: Color,
pub on_surface: Color,
pub surface_variant: Color,
pub on_surface_variant: Color,
pub outline: Color,
pub outline_variant: Color,
pub shadow: Color,
pub scrim: Color,
pub surface_tint: Color,
pub surface_bright: Color,
pub surface_dim: Color,
pub inverse_surface: Color,
pub inverse_on_surface: Color,
pub inverse_primary: Color,
pub surface_container: Color,
pub surface_container_high: Color,
pub surface_container_highest: Color,
pub surface_container_low: Color,
pub surface_container_lowest: Color,
pub primary_fixed: Color,
pub primary_fixed_dim: Color,
pub on_primary_fixed: Color,
pub on_primary_fixed_variant: Color,
pub secondary_fixed: Color,
pub secondary_fixed_dim: Color,
pub on_secondary_fixed: Color,
pub on_secondary_fixed_variant: Color,
pub tertiary_fixed: Color,
pub tertiary_fixed_dim: Color,
pub on_tertiary_fixed: Color,
pub on_tertiary_fixed_variant: Color,
}Expand description
A Material Design color scheme, which can be light or dark, produced from a seed color.
The default is a light Tonal Spot scheme using the 2025 color specification
and the sRGB seed #6750A4.
Fields§
§is_dark: boolIndicates if the scheme is dark mode (true) or light mode (false).
primary: ColorThe primary color of the scheme.
on_primary: ColorColor used for content on top of primary.
primary_container: ColorA container color for primary.
on_primary_container: ColorColor used for content on top of primary_container.
secondary: ColorThe secondary color of the scheme.
on_secondary: ColorColor used for content on top of secondary.
secondary_container: ColorA container color for secondary.
on_secondary_container: ColorColor used for content on top of secondary_container.
tertiary: ColorThe tertiary color of the scheme.
on_tertiary: ColorColor used for content on top of tertiary.
tertiary_container: ColorA container color for tertiary.
on_tertiary_container: ColorColor used for content on top of tertiary_container.
error: ColorThe error color of the scheme.
on_error: ColorColor used for content on top of error.
error_container: ColorA container color for error.
on_error_container: ColorColor used for content on top of error_container.
background: ColorThe background color of the scheme.
on_background: ColorColor used for content on top of background.
surface: ColorThe surface color of the scheme.
on_surface: ColorColor used for content on top of surface.
surface_variant: ColorA variant of the surface color.
on_surface_variant: ColorColor used for content on top of surface_variant.
outline: ColorThe outline color.
outline_variant: ColorA variant of the outline color.
shadow: ColorThe shadow color.
scrim: ColorThe scrim color.
surface_tint: ColorTint color used by tonal elevation overlays on surfaces.
surface_bright: ColorBrighter surface color used by expressive surface roles.
surface_dim: ColorDimmer surface color used by expressive surface roles.
inverse_surface: ColorAn inverse of the surface color.
inverse_on_surface: ColorColor used for content on top of inverse_surface.
inverse_primary: ColorAn inverse of the primary color.
surface_container: ColorA container color for surfaces.
surface_container_high: ColorA high container color for surfaces.
surface_container_highest: ColorA low container color for surfaces.
surface_container_low: ColorA low container color for surfaces.
surface_container_lowest: ColorA lowest container color for surfaces.
primary_fixed: ColorFixed primary color role that maintains the same tone in light/dark themes.
primary_fixed_dim: ColorFixed primary dim color role that maintains the same tone in light/dark themes.
on_primary_fixed: ColorContent color used on primary_fixed and primary_fixed_dim.
on_primary_fixed_variant: ColorLower-emphasis content color used on primary_fixed roles.
secondary_fixed: ColorFixed secondary color role that maintains the same tone in light/dark themes.
secondary_fixed_dim: ColorFixed secondary dim color role that maintains the same tone in light/dark themes.
on_secondary_fixed: ColorContent color used on secondary_fixed and secondary_fixed_dim.
on_secondary_fixed_variant: ColorLower-emphasis content color used on secondary_fixed roles.
tertiary_fixed: ColorFixed tertiary color role that maintains the same tone in light/dark themes.
tertiary_fixed_dim: ColorFixed tertiary dim color role that maintains the same tone in light/dark themes.
on_tertiary_fixed: ColorContent color used on tertiary_fixed and tertiary_fixed_dim.
on_tertiary_fixed_variant: ColorLower-emphasis content color used on tertiary_fixed roles.
Implementations§
Source§impl MaterialColorScheme
impl MaterialColorScheme
Sourcepub fn light_from_seed(seed: Color) -> Self
pub fn light_from_seed(seed: Color) -> Self
Generates a light color scheme derived from a linear sRGB seed color.
Sourcepub fn dark_from_seed(seed: Color) -> Self
pub fn dark_from_seed(seed: Color) -> Self
Generates a dark color scheme derived from a linear sRGB seed color.
Sourcepub fn content_color_for(&self, background: Color) -> Option<Color>
pub fn content_color_for(&self, background: Color) -> Option<Color>
Returns the matching content color for a background color in this scheme.
When the background color does not match a known scheme color, this
returns None.
Sourcepub fn surface_color_at_elevation(&self, elevation: Dp) -> Color
pub fn surface_color_at_elevation(&self, elevation: Dp) -> Color
Computes the surface tonal color at an elevation.
Sourcepub fn surface_color_at_elevation_for(
&self,
background: Color,
elevation: Dp,
) -> Color
pub fn surface_color_at_elevation_for( &self, background: Color, elevation: Dp, ) -> Color
Returns surface_color_at_elevation for the scheme surface, otherwise
returns background.
Trait Implementations§
Source§impl Clone for MaterialColorScheme
impl Clone for MaterialColorScheme
Source§fn clone(&self) -> MaterialColorScheme
fn clone(&self) -> MaterialColorScheme
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MaterialColorScheme
impl Debug for MaterialColorScheme
Source§impl Default for MaterialColorScheme
impl Default for MaterialColorScheme
Source§impl PartialEq for MaterialColorScheme
impl PartialEq for MaterialColorScheme
impl StructuralPartialEq for MaterialColorScheme
Auto Trait Implementations§
impl Freeze for MaterialColorScheme
impl RefUnwindSafe for MaterialColorScheme
impl Send for MaterialColorScheme
impl Sync for MaterialColorScheme
impl Unpin for MaterialColorScheme
impl UnsafeUnpin for MaterialColorScheme
impl UnwindSafe for MaterialColorScheme
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.