diff --git a/VDS/Classes/ColorConfiguration.swift b/VDS/Classes/ColorConfiguration.swift index 9d902a1d..e0b3a7c1 100644 --- a/VDS/Classes/ColorConfiguration.swift +++ b/VDS/Classes/ColorConfiguration.swift @@ -111,7 +111,6 @@ public class ControlColorConfiguration: KeyColorConfigurable { public typealias KeyType = UIControl.State public typealias ObjectType = Surfaceable & UIControl public var keyColors: [KeyColorConfiguration] = [] - private var lastKeyColor: KeyColorConfiguration? public required init() { } @@ -130,26 +129,11 @@ public class ControlColorConfiguration: KeyColorConfigurable { public func getColor(_ object: any ObjectType) -> UIColor { let state = object.state let surface = object.surface - - // find the exact match - if let keyColor = keyColors.first(where: {$0.key == state }) { - lastKeyColor = keyColor - return keyColor.surfaceConfig.getColor(surface) - } else if state.contains(.disabled), let keyColor = keyColors.first(where: {$0.key == .disabled }) { - lastKeyColor = keyColor + if let keyColor = keyColors.first(where: {$0.key.isSubset(of: state) }) { return keyColor.surfaceConfig.getColor(surface) - - } else if state.contains(.highlighted), let keyColor = keyColors.first(where: {$0.key == .highlighted }) { - lastKeyColor = keyColor - return keyColor.surfaceConfig.getColor(surface) - } else { - if let lastKeyColor { - return lastKeyColor.surfaceConfig.getColor(surface) - } else { - return .clear - } + return .clear } } }