Simplify ThemeFromPreferences by removing lambdas
parent
492d5217d0
commit
25e7c7ec61
@ -0,0 +1,18 @@
|
||||
package org.thoughtcrime.securesms.ui.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
fun interface MaybeFollowSystemColors {
|
||||
@Composable
|
||||
fun get(): ThemeColors
|
||||
}
|
||||
|
||||
fun FollowSystemColors(light: ThemeColors, dark: ThemeColors) = MaybeFollowSystemColors {
|
||||
when {
|
||||
isSystemInDarkTheme() -> dark
|
||||
else -> light
|
||||
}
|
||||
}
|
||||
|
||||
fun IgnoreSystemColors(colors: ThemeColors) = MaybeFollowSystemColors { colors }
|
||||
Loading…
Reference in New Issue