Hi, I'm reading a strange sentence in a compose co...
# compose
p
Hi, I'm reading a strange sentence in a compose codelab, they state this after changing theme colors:
Copy code
If you go back to MainActivity.kt and refresh the preview, the preview colors don't actually change! That's because by default, your Preview will use dynamic colors. You can see the logic for adding dynamic coloring in Theme.kt, using the dynamicColor boolean parameter.
To see the non-adaptive version of your color scheme, run your app on a device with API level lower than 31 (corresponding to Android S, where adaptive colors were introduced). You'll see the new colors
Why using dynamic colors makes the preview to not display the changes? Is that a bug? They force you to use and old emulator to see the changes. I don't see this as normal.
k
Hi Pablo, Dynamic Colors are not the bug. Basically, by making the dynamic color true in the theme file, our application will adopt the colors from the wallpapers automatically.
E.g, If our mobile wallpaper is any nature with green leaves. Then it will detect those colors and will automatically apply to our ui. You can checkout on the theme builder for a demo: https://material-foundation.github.io/material-theme-builder/
You'll understand by these images.
p
thank you
🙌 1