Skip to content

Commit e4ccd60

Browse files
authored
Color safeSum in forest green as used in the Grayson Dot (#535)
## Summary The chart includes the Grayson Dot - a different color green applied to green dots with more than 7d buffer. The iOS app colors the `safeSum` using colors based on the colors of the dots. This text appears in both the gallery in a goal's cell as well as in the goal screen itself. Previously the same green was being used for all `safeSum` with a `safeBuf` greater than three. Implements #206 ## Validation Ran app in the simulator using the new colors and logic. Made screenshots.
1 parent dcae107 commit e4ccd60

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

BeeKit/GoalExtensions.swift

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,18 @@ extension Goal {
5555
}
5656

5757
public var countdownColor :UIColor {
58-
let buf = self.safeBuf
59-
if buf < 1 {
60-
return UIColor.Beeminder.red
58+
switch self.safeBuf {
59+
case ..<1:
60+
return UIColor.Beeminder.SafetyBuffer.red
61+
case ..<2:
62+
return UIColor.Beeminder.SafetyBuffer.orange
63+
case ..<3:
64+
return UIColor.Beeminder.SafetyBuffer.blue
65+
case ..<7:
66+
return UIColor.Beeminder.SafetyBuffer.green
67+
default:
68+
return UIColor.Beeminder.SafetyBuffer.forestGreen
6169
}
62-
else if buf < 2 {
63-
return UIColor.Beeminder.orange
64-
}
65-
else if buf < 3 {
66-
return UIColor.Beeminder.blue
67-
}
68-
return UIColor.Beeminder.green
6970
}
7071

7172
public var hideDataEntry: Bool {

BeeKit/UI/UIColorExtension.swift

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,21 @@ import UIKit
1212
extension UIColor {
1313

1414
public struct Beeminder {
15-
public static let green = UIColor(red: 81.0/255.0,
16-
green: 163.0/255.0,
17-
blue: 81.0/255.0,
18-
alpha: 1)
19-
20-
public static let blue: UIColor = .systemBlue
21-
public static let orange: UIColor = .systemOrange
2215
public static let red: UIColor = .systemRed
2316

24-
public static let gray = UIColor(white: 0.7, alpha: 1.0)
17+
public static let gray = UIColor.systemGray
2518

2619
public static let yellow = UIColor(red: 255.0/255.0,
2720
green: 217.0/255.0,
2821
blue: 17.0/255.0,
2922
alpha: 1)
23+
24+
public struct SafetyBuffer {
25+
public static let red: UIColor = .systemRed // .init(red: 1, green: 0, blue: 0, alpha: 1)
26+
public static let orange: UIColor = .systemOrange // .init(red: 1, green: 165/255.0, blue: 00, alpha: 1)
27+
public static let blue: UIColor = .systemBlue // .init(red: 63/255.0, green: 63/255.0, blue: 1, alpha: 1)
28+
public static let green: UIColor = .systemGreen // .init(red: 0, green: 170/255.0, blue: 0, alpha: 1)
29+
public static let forestGreen: UIColor = .init(red: 34/255.0, green: 139/255.0, blue: 34/255.0, alpha: 1)
30+
}
3031
}
3132
}

0 commit comments

Comments
 (0)