Fixed the hex color visibility.
This commit is contained in:
@@ -11,7 +11,7 @@ import Foundation
|
||||
|
||||
extension MTColor {
|
||||
|
||||
static func color(fromHexString hexString:String) -> MTColor? {
|
||||
public convenience init?(fromHexString hexString:String) {
|
||||
if hexString.isEmpty { return nil }
|
||||
if !hexString.hasPrefix("#") { return nil }
|
||||
|
||||
@@ -19,10 +19,10 @@ extension MTColor {
|
||||
let scanner = Scanner(string: hexString)
|
||||
scanner.charactersToBeSkipped = CharacterSet(charactersIn: "#")
|
||||
scanner.scanHexInt64(&rgbValue)
|
||||
return MTColor(red: CGFloat((rgbValue & 0xFF0000) >> 16)/255.0,
|
||||
green: CGFloat((rgbValue & 0xFF00) >> 8)/255.0,
|
||||
blue: CGFloat((rgbValue & 0xFF))/255.0,
|
||||
alpha: 1.0)
|
||||
self.init(red: CGFloat((rgbValue & 0xFF0000) >> 16)/255.0,
|
||||
green: CGFloat((rgbValue & 0xFF00) >> 8)/255.0,
|
||||
blue: CGFloat((rgbValue & 0xFF))/255.0,
|
||||
alpha: 1.0)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user