Kefas
07/22/2021, 11:10 AMMaterialTheme {
CompositionLocalProvider(
LocalContentAlpha provides ContentAlpha.high
) {
Surface(color = MaterialTheme.colors.primary) {
LocalContentAlpha.current // 0.87 (LowContrastAlpha)
ContentAlpha.high // 1.0 (HighContrastAlpha)
}
}
}
alorma
07/22/2021, 11:13 AMCompositionLocalProvider(
LocalContentAlpha provides ...
)
Kefas
07/22/2021, 11:14 AMLocalContentAlpha
. What happens here is that:
• The ContentAlpha.high is recalculated, and because of the content color is light on light theme, it provides high contrast alpha.
• LocalContentAlpha uses previously calculated alpha when the content color is dark on light theme, it uses low contrast alpha.