Fix priority menu icons: use UIImage.withTintColor for exact colored flags
foregroundStyle is overridden by Menu tint; baking color into UIImage with .alwaysOriginal rendering mode is the only reliable approach. Co-Authored-By: Kutesir <tqwyy79vzn@privaterelay.appleid.com>
This commit is contained in:
@@ -1547,8 +1547,7 @@ struct AddTaskSheet: View {
|
|||||||
Label {
|
Label {
|
||||||
Text(p.label)
|
Text(p.label)
|
||||||
} icon: {
|
} icon: {
|
||||||
Image(systemName: p == .none ? "flag" : "flag.fill")
|
Image(uiImage: priorityFlagImage(p))
|
||||||
.foregroundStyle(p.color)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1635,6 +1634,20 @@ struct AddTaskSheet: View {
|
|||||||
priority: selectedPriority)
|
priority: selectedPriority)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func priorityFlagImage(_ p: Priority) -> UIImage {
|
||||||
|
let name: String
|
||||||
|
let uiColor: UIColor
|
||||||
|
switch p {
|
||||||
|
case .high: name = "flag.fill"; uiColor = .systemRed
|
||||||
|
case .medium: name = "flag.fill"; uiColor = .systemYellow
|
||||||
|
case .low: name = "flag.fill"; uiColor = .systemBlue
|
||||||
|
case .none: name = "flag"; uiColor = .systemGray3
|
||||||
|
}
|
||||||
|
let cfg = UIImage.SymbolConfiguration(pointSize: 17, weight: .medium)
|
||||||
|
return (UIImage(systemName: name, withConfiguration: cfg) ?? UIImage())
|
||||||
|
.withTintColor(uiColor, renderingMode: .alwaysOriginal)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Task Date Picker Sheet
|
// MARK: - Task Date Picker Sheet
|
||||||
|
|||||||
Reference in New Issue
Block a user