pub struct DynamicScheme {Show 13 fields
pub source_color_hct: Hct,
pub source_color_argb: u32,
pub variant: Variant,
pub contrast_level: f64,
pub is_dark: bool,
pub platform: Platform,
pub spec_version: SpecVersion,
pub primary_palette: TonalPalette,
pub secondary_palette: TonalPalette,
pub tertiary_palette: TonalPalette,
pub neutral_palette: TonalPalette,
pub neutral_variant_palette: TonalPalette,
pub error_palette: TonalPalette,
}Expand description
A dynamic color scheme generated from a source color.
Constructed by a set of values representing the current UI state (such as whether or not it’s dark theme, what the theme style is, etc.), and provides a set of TonalPalettes that can create colors that fit in with the theme style. Used by DynamicColor to resolve into a color.
Fields§
§source_color_hct: HctThe source color of the theme as an HCT color
source_color_argb: u32The source color of the theme as an ARGB 32-bit integer
variant: VariantThe variant, or style, of the theme
contrast_level: f64Value from -1 to 1. -1 represents minimum contrast, 0 represents standard, 1 represents maximum contrast
is_dark: boolWhether the scheme is in dark mode or light mode
platform: PlatformThe platform on which this scheme is intended to be used
spec_version: SpecVersionThe version of the design spec that this scheme is based on
primary_palette: TonalPaletteGiven a tone, produces a color. Hue and chroma of the color are specified in the design specification of the variant. Usually colorful.
secondary_palette: TonalPaletteGiven a tone, produces a color. Hue and chroma of the color are specified in the design specification of the variant. Usually less colorful.
tertiary_palette: TonalPaletteGiven a tone, produces a color. Hue and chroma of the color are specified in the design specification of the variant. Usually a different hue from primary and colorful.
neutral_palette: TonalPaletteGiven a tone, produces a color. Hue and chroma of the color are specified in the design specification of the variant. Usually not colorful at all, intended for background & surface colors.
neutral_variant_palette: TonalPaletteGiven a tone, produces a color. Hue and chroma of the color are specified in the design specification of the variant. Usually not colorful, but slightly more colorful than Neutral. Intended for backgrounds & surfaces.
error_palette: TonalPaletteGiven a tone, produces a reddish, colorful, color.
Implementations§
Source§impl DynamicScheme
impl DynamicScheme
Sourcepub fn new(options: DynamicSchemeOptions) -> DynamicScheme
pub fn new(options: DynamicSchemeOptions) -> DynamicScheme
Create a new DynamicScheme from options.
Uses spec-versioned palette generation delegates based on the variant and spec version. The delegate handles variant-specific, platform-aware, and dark/light mode adjustments.
§Arguments
options- Configuration for the scheme including source color, variant, contrast level, dark mode, platform, and optional custom palettes.
§Returns
A fully configured DynamicScheme with all palettes generated.
Trait Implementations§
Source§impl Clone for DynamicScheme
impl Clone for DynamicScheme
Source§fn clone(&self) -> DynamicScheme
fn clone(&self) -> DynamicScheme
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more