← All repositories

listless

A simple list app for Apple platforms

git clone https://code.inqk.net/listless.git


commit 3b738aa61aa6bfe68204e1014459c309c4970eff
parent b0609e95fa78263e6e2e1821cb72364774e68128
Author: Michael Camilleri <[email protected]>
Date:   Thu,  5 Mar 2026 01:33:23 +0900

Use accent colour for selected active tasks

Diffstat

MListlessiOS/Helpers/AppColors.swift | 16+---------------
MListlessiOS/Views/TaskRowView.swift | 16++++++++++++----

2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/ListlessiOS/Helpers/AppColors.swift b/ListlessiOS/Helpers/AppColors.swift

@@ -13,7 +13,7 @@ extension Color {
     static let taskCard = Color(uiColor: UIColor { traits in
         traits.userInterfaceStyle == .dark
             ? UIColor.secondarySystemBackground
-            : UIColor(red: 0.99, green: 0.985, blue: 0.98, alpha: 1)
+            : .white
     })
 
     /// Selected background for completed rows.
@@ -22,18 +22,4 @@ extension Color {
             ? UIColor(white: 0.12, alpha: 1)
             : UIColor(red: 0.88, green: 0.86, blue: 0.83, alpha: 1)
     })
-
-    /// Drop shadow for selected active cards in light mode.
-    static let selectionShadow = Color(uiColor: UIColor { traits in
-        traits.userInterfaceStyle == .dark
-            ? .clear
-            : UIColor(white: 0.0, alpha: 0.25)
-    })
-
-    /// Slightly tinted card surface for selected active cards.
-    static let taskCardSelected = Color(uiColor: UIColor { traits in
-        traits.userInterfaceStyle == .dark
-            ? UIColor(white: 0.15, alpha: 1)
-            : .white
-    })
 }

diff --git a/ListlessiOS/Views/TaskRowView.swift b/ListlessiOS/Views/TaskRowView.swift

@@ -171,9 +171,15 @@ struct TaskRowView: View {
                 topTrailingRadius: TaskRowMetrics.trailingCornerRadius
             )
         )
-        .shadow(
-            color: isSelected && !task.isCompleted ? .selectionShadow : .clear,
-            radius: 4, x: 0, y: 2
+        .overlay(
+            isSelected && !task.isCompleted
+                ? UnevenRoundedRectangle(
+                    topLeadingRadius: 0, bottomLeadingRadius: 0,
+                    bottomTrailingRadius: TaskRowMetrics.trailingCornerRadius,
+                    topTrailingRadius: TaskRowMetrics.trailingCornerRadius
+                )
+                .stroke(cachedAccentColor.opacity(0.40), lineWidth: 2)
+                : nil
         )
     }
 
@@ -187,8 +193,10 @@ struct TaskRowView: View {
     private var cardBackground: some View {
         if task.isCompleted {
             isSelected ? Color.completedSelected : Color.clear
+        } else if isSelected {
+            Color.taskCard.overlay(cachedAccentColor.opacity(0.15))
         } else {
-            isSelected ? Color.taskCardSelected : Color.taskCard
+            Color.taskCard
         }
     }
 }