Animating themes
When the theme changes (the user switches to dark mode, or a screen takes a brand color), you can animate between the two themes. Colors, type, shapes and any token sets are interpolated.
- Kotlin
- Dart
import com.srctool.camouflage.core.theme.animateCamoTheme
@Composable
fun App(dark: Boolean) {
val target = materialTheme(seed = brand, dark = dark)
val theme = animateCamoTheme(target, durationMillis = 300)
CamouflageProvider(skin = MaterialSkin, theme = theme) { Home() }
}
With reduced motion turned on in the system settings, the change is instant.