Is there a nice way to convert `.svg`s to `@Compos...
# compose
x
Is there a nice way to convert `.svg`s to `@Composable`s?
2
n
Is this more efficient than an svg
t
Compared to what?
coil-svg
?
c
Curious what is your use case for converting the SVGs to Composables? Theming, animation?
1
x
mostly theming/localisation
o
I guess localisation could be solved with drawables and qualifiers, but yeah, theming I think do not work. I was wondering recently if it is possible to create own
AndroidVectorParser
which will “map”
?colorPrimary
(and others) attributes to used in MaterialTheme inside Compose 🤔 So that we could apply dynamic color to images https://m3.material.io/styles/color/dynamic-color/imagery
c
Doesn't the importer in Android studio convert from svg to a drawable-svg (or w/e its called).
o
Default AS importer converts SVG to vector drawables, but OP wants image vectors, such as for example
Icons.Default.AccountCircle
is made
c
Gotcha, theming makes sense. I’m guessing then it’s tinting specific parts of an icon and not the whole thing all up?
Yes the Studio tool only does SVG -> Vector Drawable
But… we are exploring adding functionality to do SVG/VD -> Composable conversion. Basically shipping the same logic that builds the Material icons library into a tool in Studio
👌 1
👀 3
💯 4
t
I built a Gradle plugin to do it for our project. I can throw up a gist later
👀 4
🙏 1
c
Ohhh that would be cool to see. I can forward it to the team as well for consideration.
479 Views