At least I found my error with this one:

Today I tested a bit with "catalogNameComponent" and "colorNameComponent", but always received an exception. I tried to convert the selected color into NSNamedColorSpace, but didn't get it work. Has anybody got an example or a hint?

I mixed up "catalogs" and "color lists" ... all colors I selected just weren't from catalogs. If I pick a color from the "Developer" color list, the code works: a color name from the system catalog is returned by this code:

- (void)changeColor:(id)sender
{
        // Delegate of NSColorPanel
        
NSColor *namedColor = [[sender color] colorUsingColorSpaceName:NSNamedColorSpace];
        NSString *colorCatalog;
        NSString *colorName;
        if (namedColor == nil)
        {
                colorName = @"undefined";
                colorCatalog = @"undefined";
        }
        else
        {
                colorName = [namedColor colorNameComponent];
                colorCatalog = [namedColor catalogNameComponent];
        }
DebugLog(@"Color changed: %@ (%@, %@)", namedColor, colorName, colorCatalog);
}

So I'm back to my original question:

Is there a way to get the following information after a color was selected via NSColorPanel:

a) if the color was picked from a list
b) the name of the color list
c) the name of the color within this list

I'm afraid there's no way ...

Mattes _______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to