Open bubbleguuum opened 1 year ago
Forgot to mentioned this was observed on version 1.11.0-alpha02.
Also, the animation from unchecked to checked is wrong, as the check mark drawable is briefly visible during the animation before becoming entirely invisible in checked state.
Let's a consider a
MaterialSwitch
with a check mark thumb icon drawable specified withapp:thumIcon="@drawable/material_switch_check_selector"
:material_switch_check_selector.xml
material_switch_check.xml
This usually works fine and the Switch will show the check drawable when it is checked.
However, if a light theme has a dark color for
colorPrimaryContainer
and a light color forcolorOnPrimaryContainer
, the check drawable tinting does not work properly, ending up in the check mark drawable being invisible.This situation does not seem to happen with dynamic Material You themes but can happen if you generate a theme with the color library. For example a theme generated with
SchemeContent
orSchemeExpressive
with seed color#5c76aa
(a darker blue) produces a darkcolorPrimaryContainer
and a light (white actually)colorOnPrimaryContainer
, resulting in the Switch check mark not being visible when the switch is checked.SchemeMonochrome
results in a check mark barely visible (white on light gray background). All other schemes are unaffected as they produce a lightcolorPrimaryContainer
and darkcolorOnPrimaryContainer
.Here's the code that generate both colors. I wonder if for
SchemeContent
orSchemeExpressive
it should not generate (for a light theme) a lightcolorPrimaryContainer
and darkcolorOnPrimaryContainer
like for other schemes ?:The easiest way to reproduce this issue is to have a
MaterialSwitch
withapp:thumIcon="@drawable/material_switch_check_selector"
and a light theme with:Which are the colors generated by
SchemeContent
for seed color#5c76aa
.More broadly, does M3 requires that in a light theme ,
colorPrimaryContainer
must always be a light color andcolorOnPrimaryContainer
a dark one ? If that's the case, the colors returned bySchemeContent
andSchemeFidelity
are not always compliant.