Is there any way to override the default alpha va...
# compose
u
Is there any way to override the default alpha value of ripple across my app?
I have created a custom theme like this:
Copy code
@Composable
fun DsTheme(
    colors: DsColorPalette = dsLightColorPalette(),
    typography: Typography = dsTypography(),
    content: @Composable () -> Unit
) {
    CompositionLocalProvider(
        LocalDsColor provides colors,
        LocalRippleTheme provides object : RippleTheme {
            @Composable
            override fun defaultColor(): Color = LocalRippleTheme.current.defaultColor()

            @Composable
            override fun rippleAlpha(): RippleAlpha = RippleAlpha(
                pressedAlpha = 1f,
                focusedAlpha = 1f,
                draggedAlpha = 1f,
                hoveredAlpha = 1f
            )
        }
    ) {
        content()
    }
}
But it doesn’t seem to have any effect on the alpha value of ripple. The ripples are still very light in color due to very low alpha values pre-defined by Material side.
l
The framework by default caps the max alpha at 0.5: issuetracker.google.com/issues/201308665 So there isn’t really much we can do from the Compose side - presumably the alpha is correctly being applied here, but it is just being capped to 50%
😢 1
u
Thank you Louis for the clarification.
So basically, there is nothing I could do to change the alpha, right?
l
Unfortunately, yes
Not above 0.5f anyway