Re: Determine colorlist/-name after NSColorPanel
Re: Determine colorlist/-name after NSColorPanel
- Subject: Re: Determine colorlist/-name after NSColorPanel
- From: Matthias Arndt <email@hidden>
- Date: Sat, 7 Mar 2009 16:52:45 +0100
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@hidden)
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:
This email sent to email@hidden