updated colorconfiguration to look at isEnabled

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-25 15:40:07 -05:00
parent d10b575511
commit 1b9a2799b2

View File

@ -143,7 +143,7 @@ public class ControlColorConfiguration: KeyColorConfigurable {
///Meant to be used with any object that implements Surfaceable and Disabling. More than likely this is any View.
public class ViewColorConfiguration: KeyColorConfigurable {
public typealias KeyType = Bool
public typealias ObjectType = Surfaceable & Disabling
public typealias ObjectType = Surfaceable & Enabling
public var keyColors: [KeyColorConfiguration<KeyType>] = []
public required init() { }
@ -161,7 +161,7 @@ public class ViewColorConfiguration: KeyColorConfigurable {
/// - Parameter object: Object that implements Surfaceable and Disabling
/// - Returns: UIColor correspoding to either true/false for the disabled state and surface
public func getColor(_ object: ObjectType) -> UIColor {
if let keyColor = keyColors.first(where: {$0.key == object.disabled }) {
if let keyColor = keyColors.first(where: {$0.key == !object.isEnabled }) {
return keyColor.surfaceConfig.getColor(object)
} else {
return .clear //default