Prefer normal surface color over High surface color for navigation bars #167

This commit is contained in:
Artem Chepurnoy 2024-02-18 11:47:17 +02:00
parent d7fd67aeae
commit 6c08bfc9b1
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 7 additions and 4 deletions

View File

@ -14,14 +14,16 @@ class BackgroundManager {
val colorHighest: Color val colorHighest: Color
@Composable @Composable
get() { get() {
val surfaceContainer = MaterialTheme.colorScheme.surfaceContainer
val surfaceContainerHigh = MaterialTheme.colorScheme.surfaceContainerHigh val surfaceContainerHigh = MaterialTheme.colorScheme.surfaceContainerHigh
val surfaceContainerHighest = MaterialTheme.colorScheme.surfaceContainerHighest val surfaceContainerHighest = MaterialTheme.colorScheme.surfaceContainerHighest
var maxPriority = 0 var maxPriority = 0
surfaceColorsState.values.forEach { color -> surfaceColorsState.values.forEach { color ->
val priority = when (color) { val priority = when (color) {
surfaceContainerHigh -> 1 surfaceContainer -> 1
surfaceContainerHighest -> 2 surfaceContainerHigh -> 2
surfaceContainerHighest -> 3
else -> 0 else -> 0
} }
if (maxPriority < priority) { if (maxPriority < priority) {
@ -30,8 +32,9 @@ class BackgroundManager {
} }
return when (maxPriority) { return when (maxPriority) {
0 -> surfaceContainerHigh 0 -> surfaceContainer
1 -> surfaceContainerHighest 1 -> surfaceContainerHigh
2 -> surfaceContainerHighest
else -> surfaceContainerHighest else -> surfaceContainerHighest
} }
} }