https://kotlinlang.org logo
Title
m

myanmarking

09/24/2021, 10:56 AM
if i want to retrieve a themed color in a composable, not coming from the theme, but with corresponding dark/light variant, is this the correct approach for colors:
val error: Color
    @Composable get() = if(isSystemInDarkTheme()) error else error2
d

Dmitrii Smirnov

09/24/2021, 11:21 AM
it can work if your theme mode (dark/light) is always same as system mode anyway, it is better to have your own color palette and to use color from theme only
a

Albert Chang

09/24/2021, 12:57 PM
You may want to use
MaterialTheme.colors.isLight
instead of
isSystemInDarkMode()
.