Android — Material 3 JS behaviour

Dynamic color

The heart of Material You: a wallpaper colour seeds a tonal palette that tints everything — bar, FAB, chips, switch. Change the seed and the whole interface recolours with one animated sweep.

Documentation

Real scenarios

The component as it is used in a product — not a specimen grid.

One seed, a whole palette

Pick a wallpaper seed — eight roles recompute with color-mix in oklab and the little radio app recolours in one sweep: bar, card, chips, switch, progress and FAB. The last swatch is a free picker.

Wallpaper

Nabu radio

Album of the week «Rain on Shiraz» · 12 tracks · 44 min
Auto-mix at night

Roles keep the 40/100 and 90/10 tone pairings, so text on every container stays legible whatever the seed — even the free picker.

Important props

Important props
Prop Type Default What it does
seed color '#6750A4' The seed colour; six presets plus a custom pick.
roles tokens '8' primary, on-primary, container, surface, on-surface-variant and friends come from the palette.
contrast ratio '≥ 4.5' Pairs use tones 40/100 or 90/10 to keep Material’s contrast.

Snippet

<div class="m3dyn" style="--seed: #6750A4">
    <!-- every role derives from the seed’s tonal palette -->
    <header class="m3dyn-bar">…</header>
    <button class="m3dyn-fab">+</button>
</div>

<style>
.m3dyn { --m3dyn-primary: var(--seed);
         --m3dyn-on-primary: color-mix(in oklab, white 88%, var(--seed));
         --m3dyn-container: color-mix(in oklab, var(--seed) 18%, white);
         --m3dyn-surface: color-mix(in oklab, var(--seed) 4%, white); }
.m3dyn-fab { background: var(--m3dyn-container); color: var(--m3dyn-on-primary); }
</style>