diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/ThemeExtensions.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/ThemeExtensions.kt
index d8aa489e0..51c73e2d0 100644
--- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/ThemeExtensions.kt
+++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/ThemeExtensions.kt
@@ -1,6 +1,7 @@
package com.fsck.k9.ui
import android.content.res.Resources.Theme
+import android.graphics.Color
import android.graphics.drawable.Drawable
import android.util.TypedValue
@@ -15,6 +16,32 @@ fun Theme.resolveColorAttribute(attrId: Int): Int {
return typedValue.data
}
+fun Theme.resolveColorAttribute(colorAttrId: Int, alphaFractionAttrId: Int, backgroundColorAttrId: Int): Int {
+ val typedValue = TypedValue()
+
+ if (!resolveAttribute(colorAttrId, typedValue, true)) {
+ error("Couldn't resolve attribute ($colorAttrId)")
+ }
+ val color = typedValue.data
+
+ if (!resolveAttribute(alphaFractionAttrId, typedValue, true)) {
+ error("Couldn't resolve attribute ($alphaFractionAttrId)")
+ }
+ val colorPercentage = TypedValue.complexToFloat(typedValue.data)
+ val backgroundPercentage = 1 - colorPercentage
+
+ if (!resolveAttribute(backgroundColorAttrId, typedValue, true)) {
+ error("Couldn't resolve attribute ($colorAttrId)")
+ }
+ val backgroundColor = typedValue.data
+
+ val red = colorPercentage * Color.red(color) + backgroundPercentage * Color.red(backgroundColor)
+ val green = colorPercentage * Color.green(color) + backgroundPercentage * Color.green(backgroundColor)
+ val blue = colorPercentage * Color.blue(color) + backgroundPercentage * Color.blue(backgroundColor)
+
+ return Color.rgb(red.toInt(), green.toInt(), blue.toInt())
+}
+
fun Theme.resolveDrawableAttribute(attrId: Int): Drawable {
val typedValue = TypedValue()
diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt
index b58281a03..18c937c28 100644
--- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt
+++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt
@@ -51,8 +51,16 @@ class MessageListAdapter internal constructor(
private val answeredIcon: Drawable = theme.resolveDrawableAttribute(R.attr.messageListAnswered)
private val forwardedAnsweredIcon: Drawable = theme.resolveDrawableAttribute(R.attr.messageListAnsweredForwarded)
private val previewTextColor: Int = theme.resolveColorAttribute(R.attr.messageListPreviewTextColor)
- private val activeItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListActiveItemBackgroundColor)
- private val selectedItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListSelectedBackgroundColor)
+ private val activeItemBackgroundColor: Int = theme.resolveColorAttribute(
+ colorAttrId = R.attr.messageListActiveItemBackgroundColor,
+ alphaFractionAttrId = R.attr.messageListActiveItemBackgroundAlphaFraction,
+ backgroundColorAttrId = R.attr.messageListActiveItemBackgroundAlphaBackground
+ )
+ private val selectedItemBackgroundColor: Int = theme.resolveColorAttribute(
+ colorAttrId = R.attr.messageListSelectedBackgroundColor,
+ alphaFractionAttrId = R.attr.messageListSelectedBackgroundAlphaFraction,
+ backgroundColorAttrId = R.attr.messageListSelectedBackgroundAlphaBackground
+ )
private val regularItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListRegularItemBackgroundColor)
private val readItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListReadItemBackgroundColor)
private val unreadItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListUnreadItemBackgroundColor)
diff --git a/app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml b/app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml
index 6483898ca..52c9bcc0d 100644
--- a/app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml
+++ b/app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml
@@ -6,7 +6,7 @@
+ android:textColor="?attr/floatingActionButtonForegroundColor"
+ app:backgroundTint="?attr/floatingActionButtonBackgroundColor"
+ app:icon="?attr/iconActionCompose"
+ app:iconTint="?attr/floatingActionButtonForegroundColor" />
diff --git a/app/ui/legacy/src/main/res/values/attrs.xml b/app/ui/legacy/src/main/res/values/attrs.xml
index 4c8f7d1c3..c17bff604 100644
--- a/app/ui/legacy/src/main/res/values/attrs.xml
+++ b/app/ui/legacy/src/main/res/values/attrs.xml
@@ -4,6 +4,8 @@
+
+
@@ -65,13 +67,18 @@
+
+
+
+
+
diff --git a/app/ui/legacy/src/main/res/values/themes.xml b/app/ui/legacy/src/main/res/values/themes.xml
index 4cc3fd819..55c4b43a1 100644
--- a/app/ui/legacy/src/main/res/values/themes.xml
+++ b/app/ui/legacy/src/main/res/values/themes.xml
@@ -16,12 +16,14 @@
- @color/material_gray_100
- @color/material_gray_100
- - @color/material_blue_600
- - @color/material_blue_800
- - @color/material_pink_400
- - @color/material_pink_200
+ - @color/material_gray_800
+ - @color/material_gray_700
+ - @color/material_pink_500
+ - @color/material_pink_300
- #ffffff
- @color/material_gray_50
+ - ?attr/colorPrimary
+ - ?attr/colorOnPrimary
- @style/Widget.K9.Toolbar
- @style/PreferenceThemeOverlay
@@ -87,13 +89,18 @@
- @drawable/ic_import_status
- @android:color/primary_text_light
- @android:color/secondary_text_light
- - #ff99d9ee
+ - ?attr/colorSecondary
+ - ?attr/colorSecondaryVariant
+ - 33%
+ - ?attr/colorSurface
- ?android:attr/windowBackground
- #ffd8d8d8
- ?attr/messageListRegularItemBackgroundColor
- ?android:attr/colorBackground
- @drawable/thread_count_box_light
- - #ff2ea7d1
+ - ?attr/colorSecondaryVariant
+ - 60%
+ - ?attr/colorSurface
- #ff696969
- #ffcccccc
- #bbbbbb
@@ -170,11 +177,13 @@
- @color/material_gray_900
- @color/material_gray_900
- - @color/material_blue_400
- - @color/material_blue_600
+ - @color/material_gray_100
+ - @color/material_gray_50
- @color/material_pink_300
- @color/material_pink_500
- @color/material_gray_900
+ - ?attr/colorPrimary
+ - ?attr/colorOnPrimary
- @style/Widget.K9.Toolbar
- @style/PreferenceThemeOverlay
@@ -240,13 +249,18 @@
- @drawable/ic_import_status
- @android:color/primary_text_dark
- @android:color/secondary_text_dark
- - #ff347489
+ - ?attr/colorSecondary
+ - ?attr/colorSecondaryVariant
+ - 25%
+ - ?attr/colorSurface
- ?android:attr/windowBackground
- ?attr/messageListRegularItemBackgroundColor
- #ff505050
- ?android:attr/colorBackground
- @drawable/thread_count_box_dark
- - #ff33b5e5
+ - ?attr/colorSecondaryVariant
+ - 50%
+ - ?attr/colorSurface
- #ffa0a0a0
- #ff333333
- #777777