diff --git a/app/apk/src/main/java/com/topjohnwu/magisk/ui/theme/MagiskTheme.kt b/app/apk/src/main/java/com/topjohnwu/magisk/ui/theme/MagiskTheme.kt new file mode 100644 index 000000000..731cb8143 --- /dev/null +++ b/app/apk/src/main/java/com/topjohnwu/magisk/ui/theme/MagiskTheme.kt @@ -0,0 +1,22 @@ +package com.topjohnwu.magisk.ui.theme + +import androidx.appcompat.app.AppCompatDelegate +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.runtime.Composable +import com.topjohnwu.magisk.core.Config +import top.yukonga.miuix.kmp.theme.MiuixTheme +import top.yukonga.miuix.kmp.theme.darkColorScheme +import top.yukonga.miuix.kmp.theme.lightColorScheme + +@Composable +fun MagiskTheme( + content: @Composable () -> Unit +) { + val darkTheme = when (Config.darkTheme) { + AppCompatDelegate.MODE_NIGHT_YES -> true + AppCompatDelegate.MODE_NIGHT_NO -> false + else -> isSystemInDarkTheme() + } + val colors = if (darkTheme) darkColorScheme() else lightColorScheme() + MiuixTheme(colors = colors, content = content) +}