K Merle
11/15/2022, 1:00 PMPedro Alberto
11/15/2022, 1:10 PMK Merle
11/15/2022, 1:57 PMdisplayLarge
text color to be MaterialTheme.colorScheme.onBackground
for example.leandro
11/15/2022, 2:08 PMPedro Alberto
11/15/2022, 2:44 PMPedro Alberto
11/15/2022, 2:46 PMPedro Alberto
11/15/2022, 2:47 PMAlex Styl
11/15/2022, 2:48 PMTextStyle
. You can use that to change the color of particular styleAlex Styl
11/15/2022, 2:48 PMdisplayLarge
though?Pedro Alberto
11/15/2022, 2:50 PMPedro Alberto
11/15/2022, 2:50 PMPedro Alberto
11/15/2022, 2:50 PMPedro Alberto
11/15/2022, 2:54 PMK Merle
11/15/2022, 5:15 PMColor.White
would make it same color in both dark and light theme. Having it defined by the MaterialTheme colorScheme would be more appropriate to the theme change.K Merle
11/15/2022, 5:17 PMdisplayLarge
is part of Material3 Typography https://m3.material.io/styles/typography/type-scale-tokens.Alex Styl
11/16/2022, 1:53 AMval Colors.myOwnColor: Color
@Composable
get() {
if (isSystemInDarkTheme()) {
return Color.Red
} else {
return Color.Blue
}
}
It’s an extension so that you can use it via MaterialTheme.colors.myOwnColor
K Merle
11/16/2022, 6:12 AMK Merle
11/17/2022, 12:34 PMTextType
as following:
@Composable
fun AppTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
dynamicColor: Boolean = false,
content: @Composable () -> Unit
) {
...
MaterialTheme(
colorScheme = colorScheme,
typography = Typography.copy(displayLarge = Typography.displayLarge.copy(color = MaterialTheme.colorScheme.onSurfaceVariant)),
content = content
)
}