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

myanmarking

01/13/2022, 6:17 PM
For a full compose app with multiple themes, is there any solution yet to themed vector drawables, like ( android:fillColor=“?attr/colorPrimary” ). Or we still need to define xml themes ?
c

Chris Sinco [G]

01/13/2022, 8:14 PM
If you use vector drawables in
Icon
you can always pass a color via tint, which could be from your theme
But that’s only if your art is intended to be one color. If not, then XML themes is one approach, or you could convert the VD into a Kotlin function with path draw commands and control it that way instead
m

myanmarking

01/13/2022, 8:15 PM
if single color, ya
is there any kind of conversion tool or sth?
c

Chris Sinco [G]

01/13/2022, 8:20 PM
Not officially, but this is how we do the icons in the Material icons library: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1638928779262800?thread_ts=1638925890.260400&cid=CJLTWPH7S
a

Andy Himberger

01/14/2022, 12:00 AM
Would be great to have that tool or the classes for it exported in some compose package. Today anyone would need to copy paste a bunch of code
c

Chris Sinco [G]

01/14/2022, 12:18 AM
Agreed - it’s something we’re considering to pursue this year as we also consider how VD should continue to operate in Compose land.
a

Albert Chang

01/14/2022, 12:44 AM
Someone has already done that. https://github.com/DevSrSouza/svg-to-compose
👍 2
c

Chris Sinco [G]

01/14/2022, 4:17 AM
Oh nice did not know that happened!