updated decoder to look for VDS Color name as well as hex
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
6c3092a1f6
commit
d92973dc55
@ -84,10 +84,17 @@ public final class Color: Codable {
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
let colorString = try container.decode(String.self)
|
||||
let components = try Color.getColorComponents(for: colorString)
|
||||
self.uiColor = components.color
|
||||
hex = components.hex
|
||||
name = components.name ?? ""
|
||||
|
||||
if let vdsColor = UIColor.VDSColor(rawValue: colorString) {
|
||||
self.uiColor = vdsColor.uiColor
|
||||
hex = uiColor.hexString ?? ""
|
||||
} else {
|
||||
let components = try Color.getColorComponents(for: colorString)
|
||||
self.uiColor = components.color
|
||||
hex = components.hex
|
||||
name = components.name ?? ""
|
||||
}
|
||||
|
||||
determineRGBA()
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user