mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
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
This commit is contained in:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user