Check out JetpackCompose.app's Newsletter - Dispatch for Android and Jetpack Compose updates
SUBSCRIBE NOW![User avatar]()
I always learn something just by skimming it that makes me want to bookmark the issue now and dig deeper later

SUBSCRIBE NOW![User avatar]()
Keep up the good work with the newsletter 💪 I really enjoy it

SUBSCRIBE NOW![User avatar]()
Dispatch is a must read for Android devs today and my go-to for keeping up with all things Jetpack Compose

SUBSCRIBE NOW![User avatar]()
Dispatch has been my go-to resource as it's packed with useful information while being fun at the same time

SUBSCRIBE NOW![User avatar]()
The content is light, fun, and still useful. I especially appreciate the small tips that are in each issue

SUBSCRIBE NOW![User avatar]()
I truly love this newsletter ❤️🔥 Spot on content and I know there's a lot of effort that goes behind it

SUBSCRIBE NOW![User avatar]()
Thanks for taking the time and energy to do it so well

JetpackCompose.app's Newsletter![User avatar]()
I always learn something just by skimming it that makes me want to bookmark the issue now and dig deeper later

JetpackCompose.app's Newsletter![User avatar]()
Keep up the good work with the newsletter 💪 I really enjoy it

JetpackCompose.app's Newsletter![User avatar]()
Dispatch is a must read for Android devs today and my go-to for keeping up with all things Jetpack Compose

JetpackCompose.app's Newsletter![User avatar]()
Dispatch has been my go-to resource as it's packed with useful information while being fun at the same time

JetpackCompose.app's Newsletter![User avatar]()
The content is light, fun, and still useful. I especially appreciate the small tips that are in each issue

JetpackCompose.app's Newsletter![User avatar]()
I truly love this newsletter ❤️🔥 Spot on content and I know there's a lot of effort that goes behind it

JetpackCompose.app's Newsletter![User avatar]()
Thanks for taking the time and energy to do it so well

Colored Shadow
Author: Arthur Gonzaga
Jetpack Compose ships with a shadow Modifier that makes is really trivial to add a shadow to your Composable. However, shadows in Jetpack Compose do not have the ability to customize their color. This snippet provides a solution to overcome this limitation using Modifiers and the classic Android paint object.
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Paint
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
fun Modifier.coloredShadow(
color: Color,
alpha: Float = 0.2f,
borderRadius: Dp = 0.dp,
shadowRadius: Dp = 20.dp,
offsetY: Dp = 0.dp,
offsetX: Dp = 0.dp
) = composed {
val shadowColor = color.copy(alpha = alpha).toArgb()
val transparent = color.copy(alpha= 0f).toArgb()
this.drawBehind {
this.drawIntoCanvas {
val paint = Paint()
val frameworkPaint = paint.asFrameworkPaint()
frameworkPaint.color = transparent
frameworkPaint.setShadowLayer(
shadowRadius.toPx(),
offsetX.toPx(),
offsetY.toPx(),
shadowColor
)
it.drawRoundRect(
0f,
0f,
this.size.width,
this.size.height,
borderRadius.toPx(),
borderRadius.toPx(),
paint
)
}
}
}
Have a project you'd like to submit? Fill this form, will ya!
If you like this snippet, you might also like:
Maker OS is an all-in-one productivity system for developers
I built Maker OS to track, manage & organize my life. Now you can do it too!
© 2025 All Rights Reserved | Made by Vinay Gaba