feat: default theme is now M3 dynamic colours

Signed-off-by: Infi <wingit@geist.ga>
This commit is contained in:
Infi 2023-05-20 17:33:07 +02:00
parent dc8abf3494
commit 795f288ab8
2 changed files with 9 additions and 1 deletions

View File

@ -2,9 +2,10 @@ package chat.revolt.api.settings
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import chat.revolt.ui.theme.Theme import chat.revolt.ui.theme.Theme
import chat.revolt.ui.theme.getDefaultTheme
object GlobalState { object GlobalState {
private var _theme = mutableStateOf(Theme.Revolt) private var _theme = mutableStateOf(getDefaultTheme())
val theme val theme
get() = _theme.value get() = _theme.value

View File

@ -117,3 +117,10 @@ fun RevoltTheme(
fun systemSupportsDynamicColors(): Boolean { fun systemSupportsDynamicColors(): Boolean {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
} }
fun getDefaultTheme(): Theme {
return when {
systemSupportsDynamicColors() -> Theme.M3Dynamic
else -> Theme.Revolt
}
}