Skip to content

Commit 918b9e2

Browse files
authored
default contact color to party color (#471)
1 parent 0c6b6c5 commit 918b9e2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

FiveCalls/FiveCalls/ContactImages.swift

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@ func defaultImage(forContact contact: Contact) -> UIImage {
1919
UIGraphicsBeginImageContext(CGSize(width: 256, height: 256))
2020

2121
let colorIndex = abs(Int(contact.id.hash)) % sampleColors.count
22-
sampleColors[colorIndex].setFill()
22+
23+
var partyColor: UIColor {
24+
switch contact.party {
25+
case "Democrat": return hexStringToColor(hexString: "#4C72A9")
26+
case "Republican": return hexStringToColor(hexString: "#A94C47")
27+
case "Independent": return hexStringToColor(hexString: "#9063CD")
28+
default: return sampleColors[colorIndex]
29+
}
30+
}
31+
32+
partyColor.setFill()
2333

2434
let context = UIGraphicsGetCurrentContext()
2535
context?.fill([CGRect(origin: .zero, size: CGSize(width: 256, height: 256))])

0 commit comments

Comments
 (0)