iamthevoid
05/18/2021, 9:01 AMcolor
parameter in each TextStyle
? I see next options
1. use resources and separate colors by folders. Good for theming, because all happens authomatically, but i don’t understand yet how to create Color from resource without @Composable colorResource
2. use colors preset from kotlin code. In this case all variants that i can imagine leads multiple if-else cases
Please, say, maybe i somehow skipped some obvious solution?Marko Novakovic
05/18/2021, 9:05 AMdarkColors
and lightColors
set up in your theme and you set colors you want there. later you can call MaterialTheme.colors
and access colors that you need, they will be day/night specificMarko Novakovic
05/18/2021, 9:07 AMCompositionLocalProvider
Marko Novakovic
05/18/2021, 9:09 AMMarko Novakovic
05/18/2021, 9:11 AMiamthevoid
05/18/2021, 9:26 AMiamthevoid
05/18/2021, 9:54 AMval dayTypography = Typography(...)
val nightTypography = Typography(...)
MaterialTheme(
colors = if (isSystemInDarkTheme()) DarkColors else LightColors,
typography = if (isSystemInDarkTheme()) dayTypography else nightTypography,
shapes = Shapes,
content = content
)
Marko Novakovic
05/18/2021, 11:44 AM