switch cond {
- case .normal: return ColorSet.current[.airPlanInforViewNormal]
+ case .normal: return ColorSetManager.current[.airPlanInforViewNormal]
- case .tired: return ColorSet.current[.airPlanInforViewTired]
+ case .tired: return ColorSetManager.current[.airPlanInforViewTired]
- case .bad: return ColorSet.current[.airPlanInforViewBad]
+ case .bad: return ColorSetManager.current[.airPlanInforViewBad]
}
}
switch cond {
- case .normal: return ColorSet.current[.airPlanInforViewBoarderNormal]
+ case .normal: return ColorSetManager.current[.airPlanInforViewBoarderNormal]
- case .tired: return ColorSet.current[.airPlanInforViewBoarderTired]
+ case .tired: return ColorSetManager.current[.airPlanInforViewBoarderTired]
- case .bad: return ColorSet.current[.airPlanInforViewBoarderBad]
+ case .bad: return ColorSetManager.current[.airPlanInforViewBoarderBad]
}
}
static let slotItemLevelViewHighAirLevelShadow = ColorName("SlotItemLevelView.airLevel.high.shadow")
}
-class ColorSet {
+protocol ColorSet {
+
+ subscript(named: ColorName) -> NSColor { get }
+}
+
+
+struct ColorSetManager {
static var current: ColorSet {
return HighContrastColorSet.shared
}
- return ColorSet.shared
+ return DefaultColorSet.shared
}
+}
+
+private struct DefaultColorSet: ColorSet {
- class var shared: ColorSet { return _shared }
-
- private static let _shared = ColorSet()
+ static let shared = DefaultColorSet()
subscript(named: ColorName) -> NSColor {
}
-class HighContrastColorSet: ColorSet {
+private struct HighContrastColorSet: ColorSet {
- override class var shared: ColorSet { return _shared }
- private static let _shared = HighContrastColorSet()
+ static let shared = HighContrastColorSet()
- override subscript(named: ColorName) -> NSColor {
+ subscript(named: ColorName) -> NSColor {
switch named {
case .damageViewBoarderBadly: return .red
- default: return super[named]
+ default: return DefaultColorSet.shared[named]
}
}
}
-class DarkModeColorSet: ColorSet {
+private struct DarkModeColorSet: ColorSet {
- override class var shared: ColorSet { return _shared }
+ private static let shared = DarkModeColorSet()
- private static let _shared = DarkModeColorSet()
-
- override subscript(named: ColorName) -> NSColor {
+ subscript(named: ColorName) -> NSColor {
switch named {
- default: return super[named]
+ default: return DefaultColorSet.shared[named]
}
}
}
case .none: return nil
- case .slightly: return ColorSet.current[.damageViewInnerSlightly]
+ case .slightly: return ColorSetManager.current[.damageViewInnerSlightly]
- case .modest: return ColorSet.current[.damageViewInnerModest]
+ case .modest: return ColorSetManager.current[.damageViewInnerModest]
- case .badly: return ColorSet.current[.damageViewInnerBadly]
+ case .badly: return ColorSetManager.current[.damageViewInnerBadly]
}
}
case .none: return nil
- case .slightly: return ColorSet.current[.damageViewBoarderSlightly]
+ case .slightly: return ColorSetManager.current[.damageViewBoarderSlightly]
- case .modest: return ColorSet.current[.damageViewBoarderModest]
+ case .modest: return ColorSetManager.current[.damageViewBoarderModest]
- case .badly: return ColorSet.current[.damageViewBoarderBadly]
+ case .badly: return ColorSetManager.current[.damageViewBoarderBadly]
}
}
private var levelColor: NSColor {
- return ColorSet.current[.slotItemLevelViewLevel]
+ return ColorSetManager.current[.slotItemLevelViewLevel]
}
switch level {
- case 1, 2, 3: return ColorSet.current[.slotItemLevelViewLowAirLevel]
+ case 1, 2, 3: return ColorSetManager.current[.slotItemLevelViewLowAirLevel]
- case 4, 5, 6, 7: return ColorSet.current[.slotItemLevelViewHighAirLevel]
+ case 4, 5, 6, 7: return ColorSetManager.current[.slotItemLevelViewHighAirLevel]
default: return nil
case 1, 2, 3:
let shadow = NSShadow()
- shadow.shadowColor = ColorSet.current[.slotItemLevelViewLowAirLevelShadow]
+ shadow.shadowColor = ColorSetManager.current[.slotItemLevelViewLowAirLevelShadow]
shadow.shadowBlurRadius = 4.0
return shadow
case 4, 5, 6, 7:
let shadow = NSShadow()
- shadow.shadowColor = ColorSet.current[.slotItemLevelViewHighAirLevelShadow]
+ shadow.shadowColor = ColorSetManager.current[.slotItemLevelViewHighAirLevelShadow]
shadow.shadowBlurRadius = 3.0
return shadow
private var greenColor: NSColor {
- return ColorSet.current[.suppliesCellGreen]
+ return ColorSetManager.current[.suppliesCellGreen]
}
private var yellowColor: NSColor {
- return ColorSet.current[.suppliesCellYellow]
+ return ColorSetManager.current[.suppliesCellYellow]
}
private var orangeColor: NSColor {
- return ColorSet.current[.suppliesCellOrange]
+ return ColorSetManager.current[.suppliesCellOrange]
}
private var redColor: NSColor {
- return ColorSet.current[.suppliesCellRedColor]
+ return ColorSetManager.current[.suppliesCellRedColor]
}
private var borderColor: NSColor {
- return ColorSet.current[.suppliesCellBorder]
+ return ColorSetManager.current[.suppliesCellBorder]
}
private var backgroundColor: NSColor {
- return ColorSet.current[.suppliesCellBackground]
+ return ColorSetManager.current[.suppliesCellBackground]
}
@objc dynamic var ship: Ship?