pub struct ColorScheme { /* private fields */ }Expand description
All semantic color roles for one appearance, with per-role overrides.
Implementations§
Source§impl ColorScheme
impl ColorScheme
Sourcepub const fn baseline(appearance: Appearance) -> Self
pub const fn baseline(appearance: Appearance) -> Self
Returns the baseline Material 3 color scheme for the given Appearance.
Sourcepub const fn appearance(&self) -> Appearance
pub const fn appearance(&self) -> Appearance
Returns the Appearance (light or dark) associated with this scheme.
Sourcepub fn set_color(&mut self, role: ColorRole, color: Argb)
pub fn set_color(&mut self, role: ColorRole, color: Argb)
Overrides one role. Callers overriding a background should also check its foreground.
Sourcepub fn with_color(self, role: ColorRole, color: Argb) -> Self
pub fn with_color(self, role: ColorRole, color: Argb) -> Self
Fluent counterpart to Self::set_color.
Sourcepub fn pair(&self, background: ColorRole) -> Option<ColorPair>
pub fn pair(&self, background: ColorRole) -> Option<ColorPair>
Resolves the standard foreground for a semantic background.
Sourcepub fn blend(&self, target: &Self, t: f32) -> Self
pub fn blend(&self, target: &Self, t: f32) -> Self
Interpolates all resolved sRGB and alpha channels. The target appearance takes effect at the midpoint. Values outside 0–1 clamp, and NaN uses 0.
Sourcepub fn surface_at_elevation(&self, elevation: Elevation) -> Argb
pub fn surface_at_elevation(&self, elevation: Elevation) -> Argb
Applies the Compose tonal-elevation tint to the surface role.
Sourcepub fn from_seed(seed: Argb, appearance: Appearance, contrast: f64) -> Self
pub fn from_seed(seed: Argb, appearance: Appearance, contrast: f64) -> Self
Generates Tonal Spot roles using MCU Spec2021. Contrast is clamped to -1 through 1. NaN selects the default contrast (0).
Source§impl ColorScheme
impl ColorScheme
Sourcepub fn from_seed_with(
seed: Argb,
appearance: Appearance,
contrast: f64,
variant: DynamicVariant,
spec_version: SpecVersion,
) -> Self
pub fn from_seed_with( seed: Argb, appearance: Appearance, contrast: f64, variant: DynamicVariant, spec_version: SpecVersion, ) -> Self
Generates a scheme for an opaque sRGB seed. Contrast clamps to −1–1, with NaN using 0. Fidelity, Content, and Monochrome resolve with Spec2021.
Sourcepub fn custom_color(&self, seed: Argb, harmonize: bool) -> CustomColorGroup
pub fn custom_color(&self, seed: Argb, harmonize: bool) -> CustomColorGroup
Resolves a Material 3 four-role CustomColorGroup for seed in this
scheme’s appearance at default contrast (0.0).
When harmonize is true, seed is shifted toward this scheme’s
ColorRole::Primary role before tone derivation.
Sourcepub fn custom_color_with_contrast(
&self,
seed: Argb,
contrast: f64,
harmonize: bool,
) -> CustomColorGroup
pub fn custom_color_with_contrast( &self, seed: Argb, contrast: f64, harmonize: bool, ) -> CustomColorGroup
Resolves a Material 3 four-role CustomColorGroup for seed in this
scheme’s appearance and requested contrast (-1.0..=1.0, NaN -> 0.0).
Uses MCU’s error-role contrast curve against a Tonal Spot scheme seeded
from this scheme’s ColorRole::Primary role.
Trait Implementations§
Source§impl Clone for ColorScheme
impl Clone for ColorScheme
Source§impl Debug for ColorScheme
impl Debug for ColorScheme
Source§impl Default for ColorScheme
impl Default for ColorScheme
Source§impl<'de> Deserialize<'de> for ColorScheme
Available on crate feature serde only.
impl<'de> Deserialize<'de> for ColorScheme
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for ColorScheme
Source§impl PartialEq for ColorScheme
impl PartialEq for ColorScheme
Source§impl Serialize for ColorScheme
Available on crate feature serde only.
impl Serialize for ColorScheme
serde only.impl StructuralPartialEq for ColorScheme
Auto Trait Implementations§
impl Forget for ColorScheme
impl Freeze for ColorScheme
impl Move for ColorScheme
impl RefUnwindSafe for ColorScheme
impl Send for ColorScheme
impl Sync for ColorScheme
impl Unpin for ColorScheme
impl UnsafeUnpin for ColorScheme
impl UnwindSafe for ColorScheme
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.