How does button get ripple color based on it's con...
# compose
u
How does button get ripple color based on it's contents? I visually see it picks up
contentColor
, but I want to find it in sources, I don't see the reference anywhere. I need it to use a different color nothing is passed-in to the
indication
c
Copy code
@param color the color of the ripple. This color is usually the same color used by the text or iconography in the component. This color will then have [RippleTheme.rippleAlpha] applied to calculate the final color used to draw the ripple. If [Color.Unspecified] is provided the color used will be [RippleTheme.defaultColor] instead.
u
where are you reading that?
c
the documentation of
rememberRipple
u
right but when you look at the sources, the color argument is never specified
Copy code
.clickable(
    interactionSource = interactionSource,
    indication = rememberRipple(),
    enabled = enabled,
    onClick = onClick
),
c
If [Color.Unspecified] is provided the color used will be [RippleTheme.defaultColor] instead.
u
oh so a composition local?
y
you need to dig deep into that composable and get where they set the ripple color than make you. own custom component
c
No, you just need to provide a custom Ripple theme.
u
RippleTheme is deprecated btw
u
sure but from what I gather is theres no global way to set a ripple & it needs to be per component.. no?
u
hm..weird..
LocalRippleConfiguration
that looks fine
c
🤷‍♂️ yes, haven’t used it but you can give it a try.
u
Screenshot_20240525-115938.png