commonMain.com.softartdev.theme.pref.ThemePrefs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of theme-prefs-desktop Show documentation
Show all versions of theme-prefs-desktop Show documentation
Kotlin Multiplatform library for easy switching Dark/Light Material themes on Compose.
The newest version!
package com.softartdev.theme.pref
import androidx.compose.runtime.*
val LocalThemePrefs = staticCompositionLocalOf {
error("CompositionLocal LocalThemePrefs not present")
}
abstract class ThemePrefs(
val preferenceHelper: PreferenceHelper,
) {
val darkThemeState: MutableState = mutableStateOf(preferenceHelper.themeEnum)
}
object PreferableMaterialTheme {
val themePrefs: ThemePrefs
@Composable
@ReadOnlyComposable
get() = LocalThemePrefs.current
}