I'm trying to (properly) implement Material Themin...
# compose
r
I'm trying to (properly) implement Material Theming in my app so that it can support light and dark themes. One screen of my app requires additional colors beyond the Material primary, secondary, etc. I was looking at the Rally sample app as a model because it uses extra colors to color code the account types. However, it uses `Color`s, which appears to go against the advice to use
MaterialTheme.colors
instead. What is the recommended way to declare additional colors that are sensitive to theme changes? (References in 🧵.)
References: - https://material.io/design/color/the-color-system.html#color-theme-creation : On Rally app: "Additional colors for data visualization. Apps can use additional colors to convey categories that are outside of your main color theme. They are still a part of your full color palette." - https://material.io/blog/material-theme-builder : "We strongly recommend referencing the Colors provided to the
MaterialTheme
composable via
MaterialTheme.colors
and not the values defined in
Colors.kt
in your UI. This will allow you to accept dynamic colors and easily switch between light and dark themes."
a
r
Ok, thanks, I guess there's only a "roll your own" solution then. I'll read up on it.
👍 1
l
r
That looks like a cleaner way to do it -- thanks.
c
I feel like Nick Butcher talked about themeOverlays in compose a few months ago here on slack.