Hello! How one could control the ripple color? I h...
# compose
a
Hello! How one could control the ripple color? I have a Card representing a list item and when the dark theme is On - the ripple looks OK, when the light theme is On the ripple color seems to be kinda white instead of the usual grey.
I tried the fix with setting .clickable()
Copy code
.clickable(
    indication = rememberRipple(
        color = MeterialTheme.colors.primary,
    ),
    interactionSource = remember { MutableInteractionSource() },
) { },
but that did nothing
I’m thinking… may be I messed up with the Theme colors? Any help on the subject would be appreciated
k
What happens when you set a hardcoded color like
Color.Red
in
rememberRipple
?
a
Yeah, I tried that too, @Kirill Grouchnikov forgot to mention. The ripple stays whitish.
As it is mentioned here in a workaround for a
DropdownMenuItem
which I faced later in the project development too https://kotlinlang.slack.com/archives/CJLTWPH7S/p1628105337051100?thread_ts=1628101862.049500&cid=CJLTWPH7S the ripple takes
ContentColor
as its starting point of building the ripple color, so by providing it to the Card I managed to achieve normal greyish ripple color for the light theme.
Copy code
Card(.., contentColor = AppTheme.colors.myBaseForRippleColor)
However, I’m still confused, what is it — the
ContentColor
? E.g. a text color of a dropdownMenuItem or a title text color of a Card, and more importantly, why it works for light theme only when provided explicitly.
the only idea I have is that one should be more accurate in building its brand AppTheme when overriding LocalAppColors and etc. So if anybody faced same issues, please, share in the thread, no matter how outdated this thread will become))