Material You Dynamic Color

阅读时间 8 分钟更新于 2026-06-28
📘 本文内容为英文原文,提供最准确的技术信息。中文解读和实操指南正在完善中。你也可以使用页面顶部的翻译工具。

Here's the thing about Material You: it's the first time a mobile OS built an entire theming engine around one wallpaper image. Not a preset palette picker. Not five theme options. A full algorithmic pipeline that extracts seed colors from your photo, maps them through perceptual color science, and generates 60+ token values covering every surface, text, icon, and state in the system.

The algorithm behind it — HCT (Hue, Chroma, Tone) — is Google's answer to HSL's perceptual failures. It treats lightness the way human vision actually works, so a tone-50 blue and a tone-50 green genuinely look equally bright. That matters when you're auto-generating an entire UI from a single seed.

原理详解

Google Messages uses dynamic color to make conversations feel personal. The chat bubble backgrounds shift to match the user's wallpaper-derived secondary color. Google reported a 12% increase in daily active usage after the Material You redesign in Pixel phones (Google I/O 2022 keynote data).

Spotify's Android app adopted dynamic theming selectively. They use the system accent for navigation highlights and selection states but keep their signature green for brand-critical elements like the play button and premium badges. The hybrid approach preserves brand recognition while feeling native.

Samsung's One UI 6 extends Material You with additional palette slots. Their implementation generates 16 base colors from the wallpaper instead of Google's 5, offering users more granular control. Samsung's internal UX research found that 73% of users who tried dynamic theming kept it enabled after 30 days.

Notion's Android client initially ignored dynamic color, then shipped partial support in 2024. They map the system accent to interactive elements (toggles, selected tabs, link underlines) but protect their workspace canvas from tinting. Their PM noted that full dynamic theming made documents feel inconsistent when users switched wallpapers frequently.

| Implementation approach | Brand safety | Native feel | Complexity | | --- | --- | --- | --- | | Full dynamic (all surfaces) | Low | High | Low | | Hybrid (accent only) | High | Medium | Medium | | Selective (nav + states) | High | High | High | | Ignore (static theme) | Maximum | Low | None |

科学原理

Google Messages uses dynamic color to make conversations feel personal. The chat bubble backgrounds shift to match the user's wallpaper-derived secondary color. Google reported a 12% increase in daily active usage after the Material You redesign in Pixel phones (Google I/O 2022 keynote data).

Spotify's Android app adopted dynamic theming selectively. They use the system accent for navigation highlights and selection states but keep their signature green for brand-critical elements like the play button and premium badges. The hybrid approach preserves brand recognition while feeling native.

Samsung's One UI 6 extends Material You with additional palette slots. Their implementation generates 16 base colors from the wallpaper instead of Google's 5, offering users more granular control. Samsung's internal UX research found that 73% of users who tried dynamic theming kept it enabled after 30 days.

Notion's Android client initially ignored dynamic color, then shipped partial support in 2024. They map the system accent to interactive elements (toggles, selected tabs, link underlines) but protect their workspace canvas from tinting. Their PM noted that full dynamic theming made documents feel inconsistent when users switched wallpapers frequently.

| Implementation approach | Brand safety | Native feel | Complexity | | --- | --- | --- | --- | | Full dynamic (all surfaces) | Low | High | Low | | Hybrid (accent only) | High | Medium | Medium | | Selective (nav + states) | High | High | High | | Ignore (static theme) | Maximum | Low | None |

真实案例

Google Messages uses dynamic color to make conversations feel personal. The chat bubble backgrounds shift to match the user's wallpaper-derived secondary color. Google reported a 12% increase in daily active usage after the Material You redesign in Pixel phones (Google I/O 2022 keynote data).

Spotify's Android app adopted dynamic theming selectively. They use the system accent for navigation highlights and selection states but keep their signature green for brand-critical elements like the play button and premium badges. The hybrid approach preserves brand recognition while feeling native.

Samsung's One UI 6 extends Material You with additional palette slots. Their implementation generates 16 base colors from the wallpaper instead of Google's 5, offering users more granular control. Samsung's internal UX research found that 73% of users who tried dynamic theming kept it enabled after 30 days.

Notion's Android client initially ignored dynamic color, then shipped partial support in 2024. They map the system accent to interactive elements (toggles, selected tabs, link underlines) but protect their workspace canvas from tinting. Their PM noted that full dynamic theming made documents feel inconsistent when users switched wallpapers frequently.

| Implementation approach | Brand safety | Native feel | Complexity | | --- | --- | --- | --- | | Full dynamic (all surfaces) | Low | High | Low | | Hybrid (accent only) | High | Medium | Medium | | Selective (nav + states) | High | High | High | | Ignore (static theme) | Maximum | Low | None |

Extract Material You dynamic color tokens in Android (Kotlin)

// Access Material You dynamic color scheme in Jetpack Compose
@Composable
fun DynamicThemeExample() {
    val context = LocalContext.current
    // dynamicLightColorScheme / dynamicDarkColorScheme available on Android 12+
    val colorScheme = when {
        Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
            if (isSystemInDarkTheme()) dynamicDarkColorScheme(context)
            else dynamicLightColorScheme(context)
        }
        else -> LightColorScheme // fallback for older devices
    }

    MaterialTheme(colorScheme = colorScheme) {
        Surface(color = MaterialTheme.colorScheme.surface) {
            Column {
                Text(
                    "Primary: ${colorScheme.primary}",
                    color = colorScheme.onPrimary
                )
                Button(
                    onClick = { /* action */ },
                    colors = ButtonDefaults.buttonColors(
                        containerColor = colorScheme.primaryContainer,
                        contentColor = colorScheme.onPrimaryContainer
                    )
                ) {
                    Text("Dynamic Button")
                }
            }
        }
    }
}

// For web: extract Material You-style tonal palette from a seed hex
function hctTone(seedHex: string, tone: number): string {
  // Uses @material/material-color-utilities
  const argb = argbFromHex(seedHex);
  const hct = Hct.fromInt(argb);
  const shifted = Hct.from(hct.hue, hct.chroma, tone);
  return hexFromArgb(shifted.toInt());
}

// Generate a 13-step tonal palette
const tones = [0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100];
const seed = '#6750A4'; // Google's default purple
const palette = tones.map(t => ({ tone: t, hex: hctTone(seed, t) }));
console.table(palette);

复制粘贴到项目即可使用。

💡 高手技巧

工具推荐

Google Messages uses dynamic color to make conversations feel personal. The chat bubble backgrounds shift to match the user's wallpaper-derived secondary color. Google reported a 12% increase in daily active usage after the Material You redesign in Pixel phones (Google I/O 2022 keynote data).

Spotify's Android app adopted dynamic theming selectively. They use the system accent for navigation highlights and selection states but keep their signature green for brand-critical elements like the play button and premium badges. The hybrid approach preserves brand recognition while feeling native.

Samsung's One UI 6 extends Material You with additional palette slots. Their implementation generates 16 base colors from the wallpaper instead of Google's 5, offering users more granular control. Samsung's internal UX research found that 73% of users who tried dynamic theming kept it enabled after 30 days.

Notion's Android client initially ignored dynamic color, then shipped partial support in 2024. They map the system accent to interactive elements (toggles, selected tabs, link underlines) but protect their workspace canvas from tinting. Their PM noted that full dynamic theming made documents feel inconsistent when users switched wallpapers frequently.

| Implementation approach | Brand safety | Native feel | Complexity | | --- | --- | --- | --- | | Full dynamic (all surfaces) | Low | High | Low | | Hybrid (accent only) | High | Medium | Medium | | Selective (nav + states) | High | High | High | | Ignore (static theme) | Maximum | Low | None |

免费工具推荐

用这些免费工具实操你学到的知识: