From d92973dc551e52338116c1791a2244c8e05bf68b Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 14 Dec 2023 15:12:38 -0600 Subject: [PATCH] updated decoder to look for VDS Color name as well as hex Signed-off-by: Matt Bruce --- MVMCoreUI/CustomPrimitives/Color.swift | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/CustomPrimitives/Color.swift b/MVMCoreUI/CustomPrimitives/Color.swift index b251f778..9245153d 100644 --- a/MVMCoreUI/CustomPrimitives/Color.swift +++ b/MVMCoreUI/CustomPrimitives/Color.swift @@ -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() }