# compose

Paul Woitaschek

05/28/2021, 1:09 PM
How do you handle image resources in compose? I have a xml vector that has 4 different colors I need to change at runtime. Using the old xml stuff I'd create a context theme wrapper that wraps a theme and then fetch the drawable. Is there any good solution for compose? The only "workaround" I've found is to do that inside compositon local provider:
Copy code
CompositionLocalProvider(LocalContext provides LocalContext.current.withTheme( {
            modifier = Modifier.align(Alignment.TopEnd),
            painter = painterResource(id = R.drawable.my_image), contentDescription = null

Adam Powell

05/28/2021, 3:12 PM
@Nader Jawad

Nader Jawad

05/28/2021, 10:19 PM
We have an experimental API for AnimatedImageVector which is the equivalent to AnimatedVectorDrawable but in compose. Internally it supports an optional lookup mapping to override the default property for any named path or group. We're still iterating in this space and have not exposed it externally yet so the solution you have currently is probably the easiest way to support this case for now.

Paul Woitaschek

05/31/2021, 8:15 PM
Looking forward towards this, it's good the hear that it's being evaluated.