rememberDynamicLightDarkColors

fun rememberDynamicLightDarkColors(seedColor: Color, primary: Color? = null, secondary: Color? = null, tertiary: Color? = null, neutral: Color? = null, neutralVariant: Color? = null, error: Color? = null, style: PaletteStyle = PaletteStyle.TonalSpot, contrastLevel: Double = Contrast.Default.value, specVersion: ColorSpec.SpecVersion = ColorSpec.SpecVersion.Default, platform: DynamicScheme.Platform = DynamicScheme.Platform.Default): Pair<Map<ThemeToken<Color>, Color>, Map<ThemeToken<Color>, Color>>

Generates a light and a dark scheme from seedColor and remembers the token values of each.

The result is a value for a theme property, so your theme decides where it goes. Put the light colors in the base values and the dark colors in the com.composeunstyled.theme.ColorScheme.Dark block, next to anything else that scheme changes.

val AppTheme = buildThemeV2 {
// Set this property to enable color transitions.
colorSchemeTransitionSpec = tween(300)

val (light, dark) = rememberDynamicLightDarkColors(seedColor = seed)
properties[MaterialKolorTokens.colors] = light

colorScheme(ColorScheme.Dark) {
properties[MaterialKolorTokens.colors] = dark
}
}

Base values are the fallback for every color scheme that does not set the property, so the light colors also cover com.composeunstyled.theme.ColorScheme.Light and any scheme of your own that leaves colors alone.

The parameters are the ones rememberDynamicScheme takes, minus isDark which the two schemes own.

Return

The remembered token values, light first and dark second.

Parameters

seedColor

The color to base the schemes on.

primary

The primary color of the schemes.

secondary

The secondary color of the schemes.

tertiary

The tertiary color of the schemes.

neutral

The neutral color of the schemes.

neutralVariant

The neutral variant color of the schemes.

error

The error color of the schemes.

style

The style of the schemes.

contrastLevel

The contrast level of the schemes.

specVersion

The version of the color specification to use.

platform

The platform to use for the schemes.