Dynamic Color and Adaptive Light/Dark Themes
Adapt your palette to user wallpaper and switch seamlessly between light and dark modes.
Why Dynamic Color Matters
Material 3 introduced dynamic color: an app's palette can be derived from the user's wallpaper (Android 12+) so your UI feels personal and native to the device.
- On supported devices, the system exposes a
ColorSchemesourced from the wallpaper. - On older devices or other platforms, you fall back to a brand seed color.
- The same logic must produce both a light and a dark scheme.
In this lesson you'll wire up dynamic color, build adaptive light/dark themes, and let the system decide which one to show.
Seed Color as the Foundation
Even with dynamic color, you always need a fallback. Material 3's ColorScheme.fromSeed generates a full, accessible palette from a single seed color.
- Pass
brightnessto get the matching light or dark variant. - The generated scheme guarantees correct contrast between roles like
primaryandonPrimary.
import 'package:flutter/material.dart';
final ColorScheme lightScheme = ColorScheme.fromSeed(
seedColor: const Color(0xFF6750A4),
brightness: Brightness.light,
);
final ColorScheme darkScheme = ColorScheme.fromSeed(
seedColor: const Color(0xFF6750A4),
brightness: Brightness.dark,
);All lessons in this course
- Material 3 Color Schemes and Seed Colors
- Dynamic Color and Adaptive Light/Dark Themes
- Custom ThemeExtension for Brand Tokens
- Responsive Typography and Component Theming