Convert NSColor to RGB

You need to convert the color to an RGB color space using an NSColorSpace object first, then you can get the components using the various NSColor accessor methods


Extracting RGBA values from NSColor: (Swift 3)

let nsColor:NSColor = NSColor.red
let ciColor:CIColor = CIColor(color: nsColor)!
print(ciColor.red)//1.0
print(ciColor.green)//0.0
print(ciColor.blue)//0.0
print(ciColor.alpha)//1.0 /*or use nsColor.alphaComponent*/

NOTE: NSColor.blackColor().redComponent will crash the app, but the above code won't


For a NSColor * color

CGFloat red = [color redComponent];
CGFloat green = [color greenComponent];
CGFloat blue = [color blueComponent];