# Smooth Theme Transitions in Compose with Animated ColorSchemes

DevFeed: [Smooth Theme Transitions in Compose with Animated ColorSchemes](<https://devfeed.tech/articles/smooth-theme-transitions-in-compose-with-animated-colorschemes-25120.md>)

Original publisher: [Read original article](<http://michaelevans.org/blog/2025/07/01/smooth-theme-transitions-in-compose-with-animated-colorschemes/>)

Author: Michael Evans

Published: 2025-07-02T03:38:27Z

Content type: article

Language: en

Sources: [Gadget Habit](<https://devfeed.tech/sources/gadget-habit.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Compose](<https://devfeed.tech/topics/compose.md>), [Dark Mode](<https://devfeed.tech/topics/dark-mode.md>), [ui](<https://devfeed.tech/topics/ui.md>), [Code](<https://devfeed.tech/topics/code.md>), [GitHub](<https://devfeed.tech/topics/github.md>)

Tags: [animation](<https://devfeed.tech/tags/animation.md>), [code](<https://devfeed.tech/tags/code.md>), [compose](<https://devfeed.tech/tags/compose.md>), [dark-mode](<https://devfeed.tech/tags/dark-mode.md>), [github](<https://devfeed.tech/tags/github.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [themes](<https://devfeed.tech/tags/themes.md>), [ui](<https://devfeed.tech/tags/ui.md>)

## AI overview

This article explains how to create smooth light and dark theme transitions in Jetpack Compose by animating ColorScheme properties. It compares individual color animations with a cleaner updateTransition-based approach that shares timing and easing, reduces scattered animation logic, and remains easier to extend.

## Source excerpt

If your Jetpack Compose app supports light and dark themes, you've probably noticed the default behavior: a sudden cut between color schemes when the system UI mode changes. I think we've all seen theme changes that look like this: Your browser does not support the video tag. We can do better. By wrapping your theme setup with some animation, we can achieve smooth transitions between light and dark themes that feel much more polished -- without rebuilding your entire app structure. The Idea: Animate the ColorScheme Jetpack Compose's MaterialTheme accepts a ColorScheme. If we gradually animate the colors inside that scheme when the system toggles between dark and light, we can fade the colors smoothly across the entire app. Here's a simplified example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 @Composable fun AnimatedTheme( darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit ) { val targetScheme = if (darkTheme) DarkColorScheme else LightColorScheme val animatedScheme = targetScheme.copy( primary = animateColorAsState(targetScheme.primary).value, background = animateColorAsState(targetScheme.background).value, surface = animateColorAsState(targetScheme.surface).value, onPrimary = animateColorAsState(targetScheme.onPrimary).value, // Add more swatches as needed... ) MaterialTheme( colorScheme = animatedScheme, typography = Typography, shapes = Shapes, content = content ) } You can expand this to include all 20+ color swatches if you want -- but we'll show a better way shortly. The Problem: Too Many Animations Manually animating every color swatch with animateColorAsState works, but: It's verbose It runs a lot of recompositions (even for unused swatches) It can be hard to keep up if ColorScheme changes A Better Approach: Animating with updateTransition A cleaner solution is to animate all properties as part of a single Transition. That way, Compose shares the animation clock and easing, and you're not scattering a dozen independent