mcu-dynamiccolor 0.2.2

Dynamic color system for Material Design 3
Documentation

MCU Dynamic Color

Dynamic color system for Material Design 3.

Provides runtime color resolution based on:

  • Source color (theme seed)
  • Variant (style: TonalSpot, Vibrant, etc.)
  • Dark/light mode
  • Contrast level (-1.0 to 1.0)
  • Platform (phone, watch)

Example

use mcu_dynamiccolor::{DynamicScheme, DynamicSchemeOptions, Variant};
use mcu_hct::Hct;

// Create a scheme from a source color
let source_color = Hct::from_int(0xFF0000FF); // Blue
let options = DynamicSchemeOptions::new(
    source_color,
    Variant::TonalSpot,
    0.0,  // Normal contrast
    false // Light mode
);
let scheme = DynamicScheme::new(options);

// Access palettes
let primary_palette = &scheme.primary_palette;
let surface_tone = primary_palette.get_hct(40);