Decoding NSColorSwatchData
Decoding NSColorSwatchData
- Subject: Decoding NSColorSwatchData
- From: George Browning <email@hidden>
- Date: Thu, 24 Apr 2003 15:29:13 -0400
If you resize the NSColorPanel you can get multiple rows of little
user-defined color swatch cells. You can then drag and drop colors into
those cells, and use those globally across all applications.
Pretty nifty!
The colors themselves are stored in
~/Library/Preferences/.GlobalPreferences.plist with the
NSColorSwatchData key.
For a nice usability feature in our application I'm trying to gain
access to those stored colors but can't figure out how they are encoded.
Here's what I've tried:
- I started by snarfing in the data using [[NSUserDefaults
standardUserDefaults] dataForKey:@"NSColorSwatchData"]. I've also tried
objectForKey hoping that it'll give me an NSArray, NSDictionary, or
even an NSColorList. But it just appears as NSData.
- Then I've tried taking that data through NSUnarchiver and
NSKeyedUnarchiver's unarchiveObjectWithData with no luck -- invalid
format.
- I've also tried NSPropertyListSerialization's propertyListFromData
with various formats. Still no luck.
- Looking at the raw data on a couple of user accounts I can tell
there's a common header to the data regardless of the selected colors.
- I've searched mamasam and google for NSColorSwatchData with no luck.
I can live without my feature but I thought it'd be kind of neat and
useful for the end user. I also recognize that if this swatch data is
in a proprietary Apple format that may change in the future then I
don't want a hack solution.
Does anyone else have any ideas?
Thanks!
g
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.