https://kotlinlang.org logo
#compose
Title
# compose
k

kenkyee

12/08/2019, 3:52 AM
Where does Compose get Button theme styling from? I created a new project and then changed the colorPrimary, etc. colors in my colors.xml so the non-Compose parts of the app changed colors, but the Compose part didn't. This was a unexpected :-)
g

gildor

12/08/2019, 8:25 AM
Compose has own style system (at least now)
k

kenkyee

12/08/2019, 9:23 PM
Ahh..the "MaterialTheme {}" confused me along w/ the initial color of buttons looking like a new activity I added that did use material colors. It seemed that MaterialTheme initially picked up the colorPrimary, etc. colors from the usual R.colors file 🙂 That tutorial shows you how to override this, but I guess the question why not just make the default pick up the standard old theming colors?
Wait..on that codelab screen, it says: "We provided our custom colors overriding those from 
ColorPalette
 (which default colors to the Material baseline theme unless otherwise provided)" This implies it grabs the default...unless it means the default when you create an app in Android Studio (which is what is seems to be doing)
That doc is also out of date. ColorPalette has been renamed to "MaterialColors" in case anyone else is looking for it 🤦‍♂️
l

Louis Pullen-Freilich [G]

12/08/2019, 9:51 PM
It's the other way round,
MaterialColors
was renamed to
ColorPalette
- are you using the latest artifacts? (dev 03)
And 'default' just means the colours defined in the Material baseline theme https://material.io/design/color/the-color-system.html#color-theme-creation
k

kenkyee

12/08/2019, 10:15 PM
Oops...was using
Copy code
def compose_version = "0.1.0-dev02"
because android studio didn't flag that it was old..time to hook in the usual benmanes plugin 😞 The material baseline theme makes sense...would be nice if the codelab linked to it so we wouldn't think it links to the usual Android app's theming system (which we honestly should have some way of doing if we're supposed to fold Compose in slowly into an existing app IMHO)...
l

Louis Pullen-Freilich [G]

12/09/2019, 12:50 PM
We've been thinking about integration with MDC library's theme; it's much harder to integrate with platform / AppCompat themes because they don't really match the newer Material spec for colors. There are lots of colors that just don't exist in platform themes, so even best case you would still need to go and add colors yourself, which might be more confusing than just not inferring anything from the theme.
👍 1
4 Views