forked from SwiftGen/SwiftGen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c653981
commit c0adfa4
Showing
10 changed files
with
165 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen | ||
|
||
import UIKit | ||
|
||
extension UIColor { | ||
convenience init(rgbaValue: UInt32) { | ||
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 | ||
let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 | ||
let blue = CGFloat((rgbaValue >> 8) & 0xff) / 255.0 | ||
let alpha = CGFloat((rgbaValue ) & 0xff) / 255.0 | ||
|
||
self.init(red: red, green: green, blue: blue, alpha: alpha) | ||
} | ||
} | ||
|
||
extension UIColor { | ||
enum Name : UInt32 { | ||
case ArticleBackground = 0xffcc0099 | ||
case ArticleTitle = 0x996600ff | ||
case TextColor = 0x999999ff | ||
} | ||
|
||
convenience init(named name: Name) { | ||
self.init(rgbaValue: name.rawValue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
Cyan : 0xff66ccff | ||
ArticleTitle : #33fe66 | ||
ArticleBody : 339666 | ||
Translucent : ffffffcc | ||
Cyan : 0xff66ccff | ||
ArticleTitle : #33fe66 | ||
ArticleBody : 339666 | ||
ArticleFootnote : ff66ccff | ||
Translucent : ffffffcc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen | ||
|
||
import UIKit | ||
|
||
extension UIColor { | ||
convenience init(rgbaValue: UInt32) { | ||
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 | ||
let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 | ||
let blue = CGFloat((rgbaValue >> 8) & 0xff) / 255.0 | ||
let alpha = CGFloat((rgbaValue ) & 0xff) / 255.0 | ||
|
||
self.init(red: red, green: green, blue: blue, alpha: alpha) | ||
} | ||
} | ||
|
||
{% if colors %} | ||
extension UIColor { | ||
{# Note: We don't use a UInt32 rawValue, so we can have multiple colors with the same rgbaValue #} | ||
enum {{enumName}} { | ||
{% for color in colors %} | ||
case {{color.name|swiftIdentifier}} | ||
{% endfor %} | ||
|
||
static let rgbaValues: [{{enumName}}:UInt32] = [ | ||
{% for color in colors %} | ||
.{{color.name|swiftIdentifier}} : 0x{{color.rgba}}, | ||
{% endfor %} | ||
] | ||
|
||
var rgbaValue: UInt32! { | ||
return {{enumName}}.rgbaValues[self] | ||
} | ||
} | ||
|
||
convenience init(named name: {{enumName}}) { | ||
self.init(rgbaValue: name.rgbaValue) | ||
} | ||
} | ||
{% else %} | ||
// No color found | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters