How to save a NSColor in a NSDictionary ?

I have tried saving an NSColor using NSDictionary and a NSUserDefaults but none of them worked.

myDict setObject:[NSArchiver archivedDataWithRootObject:myColor] forKey:@"mycolorkeyname"];

myColor = [NSUnarchiver unarchiveObjectWithData:[myDict objectForKey:@"mycolorkeyname"]];
There are no NSColor object defined in the DTD underlying the plist definition used by NSDictionary when saved to or read back from a file. To save a NSColor you have to convert your NSColor to something NSDictionary understand: NSData (using NSCoder or NSArchiver), NSArray of 4 colors (alpha, red, green, blue, or cmyk values…), NSDictionary of values with key being the name of the channel saved (you may also imagine a key to describe the color model used ), or even a NSString containing the hexadecimal (like web colors) representation,…
The solution using NSArchiver is the most general since it will save your NSColor object independantly of the color model used: