ADD: theming optimization
This commit is contained in:
parent
4b30d4f446
commit
ee21050e73
3 changed files with 22 additions and 27 deletions
|
@ -1,14 +1,10 @@
|
|||
package de.webfussel.soulecho.ui.theme
|
||||
|
||||
import android.os.Build
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.ColorScheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.dynamicDarkColorScheme
|
||||
import androidx.compose.material3.dynamicLightColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import de.webfussel.soulecho.LocalMoodState
|
||||
import de.webfussel.soulecho.mood.PossibleMood
|
||||
|
||||
|
@ -40,23 +36,25 @@ private val AnxiousColorTheme = createEmotionColorScheme(AnxiousFg, AnxiousBg)
|
|||
private val NervousColorTheme = createEmotionColorScheme(NervousFg, NervousBg)
|
||||
private val PanicColorTheme = createEmotionColorScheme(PanicFg, PanicBg)
|
||||
|
||||
private fun getThemeForMood (mood: PossibleMood) : ColorScheme = when (mood) {
|
||||
PossibleMood.HAPPY -> HappyColorTheme
|
||||
PossibleMood.RELAXED -> RelaxedColorTheme
|
||||
PossibleMood.CONTENT -> ContentColorTheme
|
||||
PossibleMood.SAD -> SadColorTheme
|
||||
PossibleMood.ANGRY -> AngryColorTheme
|
||||
PossibleMood.DISAPPOINTED -> DisappointedColorTheme
|
||||
PossibleMood.EMPTY -> EmptyColorTheme
|
||||
PossibleMood.ANXIOUS -> AnxiousColorTheme
|
||||
PossibleMood.NERVOUS -> NervousColorTheme
|
||||
PossibleMood.PANIC -> PanicColorTheme
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SoulEchoTheme(
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val currentTheme = LocalMoodState.current.mood
|
||||
val colorScheme = when (currentTheme) {
|
||||
PossibleMood.HAPPY -> HappyColorTheme
|
||||
PossibleMood.RELAXED -> RelaxedColorTheme
|
||||
PossibleMood.CONTENT -> ContentColorTheme
|
||||
PossibleMood.SAD -> SadColorTheme
|
||||
PossibleMood.ANGRY -> AngryColorTheme
|
||||
PossibleMood.DISAPPOINTED -> DisappointedColorTheme
|
||||
PossibleMood.EMPTY -> EmptyColorTheme
|
||||
PossibleMood.ANXIOUS -> AnxiousColorTheme
|
||||
PossibleMood.NERVOUS -> NervousColorTheme
|
||||
PossibleMood.PANIC -> PanicColorTheme
|
||||
}
|
||||
val currentMood = LocalMoodState.current.mood
|
||||
val colorScheme = getThemeForMood(currentMood)
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
<color name="transparent">#00000000</color>
|
||||
</resources>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.SoulEcho" parent="android:Theme.Material.Light.NoActionBar"/>
|
||||
<style name="Theme.SoulEcho" parent="android:Theme.Material.Light.NoActionBar">
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|
Loading…
Add table
Add a link
Reference in a new issue