Good morning guys! I have a question about compose...
# compose-android
a
Good morning guys! I have a question about compose migration that was raised here in the terms of a single source of truth. If you have a design system (XML) with colors tokens and typography already consolidated and you would initiate a Compose DS, what is the best strategy to maintain the single source of truth pattern in this case? How to access color tokens and how to access typography? Thanks!
t
Some links, assuming “Theming” is what you are looking for: • General: https://developer.android.com/jetpack/compose/designsystems • Example: https://developer.android.com/codelabs/jetpack-compose-theming#3 There is also an additional resource for covering “Migration” (staying on xml for the theming): https://developer.android.com/jetpack/compose/designsystems/views-to-compose
a
Thanks, @Thomas Urbanitsch! But my question is more about having only one source of color tokens and typography (in XML, as we already have this) for both libraries: XML-based DS and Compose-based DS
t
You want to use definitions for colors and typography written once (preferably using the xml you already have) in both XML Layouts and Compose Layouts, correct?
a
Yes! Actually, use these definitions in both design systems (XML and Compose)
t
isn’t the last link i shared explaining exactly that? (the accompanist libraries enabling you to use your xml definitions in Compose) 🤔
a
Yeah, I saw and the AppCompat Theme Adapter appears to work fine, but I don't know in the case of typography 🤔
b
There is a parameter to bring over/respect typography in MaterialThemeAdapter
a
Huuum ok! Thanks guys
m
when last I looked it was possible to convert from xml to compose but only the standard theme elements. If you added custom attributes in your xml theme they wouldn’t convert