is there a way to tint a drawable with a gradient?
# compose
t
is there a way to tint a drawable with a gradient?
l
We use this to add a dark bottom edge to anything that takes a modifier. It might be what you’re after
Copy code
fun Modifier.vDarkBottomBackgroundGradient(): Modifier {
    return this.drawWithContent {
        drawContent()
        drawRect(
            brush = Brush.verticalGradient(
                0.45f to Color.Black.copy(alpha = 0.1f),
                1.00f to Color.Black.copy(alpha = 0.5f),
            ),
            blendMode = BlendMode.Darken
        )
    }
}
There’s plenty of blend modes to play with: https://developer.android.com/reference/android/graphics/BlendMode
There’s plenty of blend modes to play with: https://developer.android.com/reference/android/graphics/BlendMode
t
Thanks, unfurtunately it's causing some strange colors for me when trying different blendModes. I guess I'll just ask the designers to make it for me lol