add the provided color name to the error string

This commit is contained in:
Kyle Matthew Hedden 2022-12-12 13:18:17 -05:00
parent 6449d68f4f
commit 7494d8664a

View File

@ -106,7 +106,7 @@ public final class Color: Codable {
if colorString.hasPrefix("#") {
hex = colorString.replacingOccurrences(of: "#", with: "")
} else {
guard let hexString = UIColor.names[colorString]?.hex else { throw ColorError.badName(reason: "Check the spelling of your color.") }
guard let hexString = UIColor.names[colorString]?.hex else { throw ColorError.badName(reason: "Check the spelling of your color: \(colorString)") }
hex = hexString.replacingOccurrences(of: "#", with: "")
name = colorString
}