add the provided color name to the error string
This commit is contained in:
parent
6449d68f4f
commit
7494d8664a
@ -106,7 +106,7 @@ public final class Color: Codable {
|
|||||||
if colorString.hasPrefix("#") {
|
if colorString.hasPrefix("#") {
|
||||||
hex = colorString.replacingOccurrences(of: "#", with: "")
|
hex = colorString.replacingOccurrences(of: "#", with: "")
|
||||||
} else {
|
} 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: "")
|
hex = hexString.replacingOccurrences(of: "#", with: "")
|
||||||
name = colorString
|
name = colorString
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user