Closed dcflow closed 9 years ago
It looks like the init method is borked somehow. Good find and I'll try and fix it this weekend.
I wonder why they call them bugs? :P
convenience init(hex: String) {
var rgbInt: UInt64 = 0
let newHex: NSString = NSString(string: hex).stringByReplacingOccurrencesOfString("#", withString: "")
var scanner = NSScanner(string: newHex)
scanner.scanHexLongLong(&rgbInt)
let r: CGFloat = CGFloat((rgbInt & 0xFF0000) >> 16)/255.0
let g: CGFloat = CGFloat((rgbInt & 0x00FF00) >> 8)/255.0
let b: CGFloat = CGFloat(rgbInt & 0x0000FF)/255.0
self.init(red: r, green: g, blue: b, alpha: 1.0)
}
One of these has an issue:
because I get different colors.
ex. Color(hex: Color.successColor().hexString()) -> returns blue