Reputation: 912
Can anyone tell me why this colorUsingColorSpaceName
is returning nil
? For example, the following code block will print "deviceColor is nill":
NSColor *color = [NSColor windowBackgroundColor];
NSColor *deviceColor = [color colorUsingColorSpaceName: NSDeviceRGBColorSpace];
if(deviceColor == nil) NSLog(@"deviceColor is nill");
How can I convert an NSColor
in the NSNamedColorSpace
? I need to be able to get the color components so i can convert an NSColor
to a CGColorRef
Upvotes: 3
Views: 1026
Reputation: 13003
It's too complicated to be expressed as an RGB value. It's a single object that draws differently when the window is active vs inactive. In some cases it's also a pattern color (i.e. a tiled image) rather than a flat fill.
Upvotes: 6