From e6c426869414a5b9b07ab50b4e4bc9c4754bc8f6 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Tue, 3 Mar 2026 11:29:53 +0800 Subject: [PATCH] Add MagiskTheme composable wrapping MiuixTheme Create MagiskTheme that wraps MiuixTheme with light/dark color scheme based on the existing Config.darkTheme preference setting. Made-with: Cursor --- .../topjohnwu/magisk/ui/theme/MagiskTheme.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/apk/src/main/java/com/topjohnwu/magisk/ui/theme/MagiskTheme.kt 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) +}