Can't convert NSNamedColorSpace to NSDeviceRGBColorSpace?

Can someone tell me why this one colorUsingColorSpaceNamereturns 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 to convert NSColorto NSNamedColorSpace? I need to get the color components so that I can convert NSColortoCGColorRef

+3
source share
1 answer

It is too complex to be expressed as an RGB value. This is the only object that draws differently when the window is active versus inactive. In some cases, this is also the color of the template (i.e., Tiled image), rather than flat filling.

+6
source

Source: https://habr.com/ru/post/1742201/


All Articles