macOS: Simplify NSColor extension

This commit is contained in:
Roopesh Chander 2019-01-21 19:07:42 +05:30
parent 150fd25569
commit a1608819f9
1 changed files with 1 additions and 1 deletions

View File

@ -19,7 +19,7 @@ extension NSColor {
var rgb: UInt32 = 0
Scanner(string: hexString).scanHexInt32(&rgb)
self.init(red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0, green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0, blue: CGFloat(rgb & 0x0000FF) / 255.0, alpha: 1)
self.init(red: CGFloat((rgb >> 16) & 0xff) / 255.0, green: CGFloat((rgb >> 8) & 0xff) / 255.0, blue: CGFloat((rgb >> 0) & 0xff) / 255.0, alpha: 1)
}
}