Match formatting used by Xcode. Turns out Xcode requires two digits for hex colors values. Single digits get repeated.
This commit is contained in:
parent
8262760bc7
commit
be2a655c40
1 changed files with 20 additions and 4 deletions
|
@ -67,10 +67,10 @@ private extension Color {
|
||||||
"color" : {
|
"color" : {
|
||||||
"color-space" : "srgb",
|
"color-space" : "srgb",
|
||||||
"components" : {
|
"components" : {
|
||||||
"alpha" : "0x\(String(alpha, radix: 16))",
|
"alpha" : "\(Double(alpha) / 0xFF)",
|
||||||
"blue" : "0x\(String(blue, radix: 16))",
|
"blue" : "0x\(blue, radix: 16, width: 2)",
|
||||||
"green" : "0x\(String(green, radix: 16))",
|
"green" : "0x\(green, radix: 16, width: 2)",
|
||||||
"red" : "0x\(String(red, radix: 16))"
|
"red" : "0x\(red, radix: 16, width: 2)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"idiom" : "universal"
|
"idiom" : "universal"
|
||||||
|
@ -88,6 +88,22 @@ private extension Color {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension String.StringInterpolation {
|
||||||
|
mutating func appendInterpolation<I: BinaryInteger>(
|
||||||
|
_ value: I,
|
||||||
|
radix: Int,
|
||||||
|
width: Int = 0,
|
||||||
|
uppercase: Bool = true
|
||||||
|
) {
|
||||||
|
var string = String(value, radix: radix, uppercase: uppercase)
|
||||||
|
if width > string.count {
|
||||||
|
string.insert(contentsOf: String(repeating: "0", count: width - string.count), at: string.startIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
appendLiteral(string)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private let group = """
|
private let group = """
|
||||||
{
|
{
|
||||||
"properties" : {
|
"properties" : {
|
||||||
|
|
Loading…
Add table
Reference in a new issue