UIColor.swift 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import SwiftUI
  2. extension UIColor {
  3. // MARK: - HIG colors
  4. // See: https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/
  5. // HIG Green has changed for iOS 13. This is the legacy color.
  6. static func HIGGreenColor() -> UIColor {
  7. UIColor(red: 76 / 255, green: 217 / 255, blue: 100 / 255, alpha: 1)
  8. }
  9. }
  10. // MARK: - Color palette for common elements
  11. extension UIColor {
  12. @nonobjc static let carbs = UIColor(named: "carbs") ?? systemGreen
  13. @nonobjc static let fresh = UIColor(named: "fresh") ?? HIGGreenColor()
  14. @nonobjc static let glucose = UIColor(named: "glucose") ?? systemTeal
  15. @nonobjc static let insulin = UIColor(named: "insulin") ?? systemOrange
  16. // The loopAccent color is intended to be use as the app accent color.
  17. @nonobjc public static let loopAccent = UIColor(named: "accent") ?? systemBlue
  18. @nonobjc public static let warning = UIColor(named: "warning") ?? systemYellow
  19. }
  20. // MARK: - Context for colors
  21. public extension UIColor {
  22. @nonobjc static let agingColor = warning
  23. @nonobjc static let axisLabelColor = secondaryLabel
  24. @nonobjc static let axisLineColor = clear
  25. @nonobjc static let cellBackgroundColor = secondarySystemBackground
  26. @nonobjc static let carbTintColor = carbs
  27. @nonobjc internal static let critical = systemRed
  28. @nonobjc static let destructive = critical
  29. @nonobjc static let freshColor = fresh
  30. @nonobjc static let glucoseTintColor = glucose
  31. @nonobjc static let gridColor = systemGray3
  32. @nonobjc static let invalid = critical
  33. @nonobjc static let insulinTintColor = insulin
  34. @nonobjc static let pumpStatusNormal = insulin
  35. @nonobjc static let staleColor = critical
  36. @nonobjc static let unknownColor = systemGray4
  37. }