Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create OSX .clr palette files?

Tags:

cocoa

In ~/Library/Colors you can find saved palette files created in OSX's color picker. What is the format of these files and how can they be created? The most I've been able to figure out is that they may be some sort of serialized NSObject data.

like image 622
Dan Avatar asked Jul 08 '12 20:07

Dan


2 Answers

They are created by the NSColorList class, documented here:

https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSColorList_Class/Reference/Reference.html

like image 82
Kevin Grant Avatar answered Nov 15 '22 16:11

Kevin Grant


This site has a much better list of stuff you can do with color lists then Apples suspiciously austere offerings.

Included are…

  • To Start Your Own Palette List
  • To Give Your Palette a Meaningful Name
  • To Add Colors to Your Palette List
  • To Name the Colors in Your Palette List
  • Finding Listed Colors by Name
  • Finding Listed Colors by Color
  • To Remove a Color from Your Palette List
  • To Remove an Entire List
  • To Open a Color Palette Stored on Your Hard Drive
  • To Make a Backup of Your Color Palette
  • To Arrange the Colors in the List (Don't get all excited; it's a tedious manual process.)

Personally I'm still after the frustratingly intangible holy Grail of getting the Pantone CLR files off of an old NeXt box. BIG ups to anyone that can snag those suckers. Crayons are for kids. HMMPH.

EDIT: Here is a simple example of how to create an NSColorList

NSColorList *list = [NSColorList.alloc initWithName:@"Pretty Colors"];
[ @{ @"mauve":     [NSColor colorWithDeviceRed:.6 green:.6 blue:.5 alpha:1],
     @"mustard":   [NSColor colorWithDeviceRed:.6 green:.5 blue:.3 alpha:1],
     @"poop-brown":[NSColor colorWithDeviceRed:.4 green:.4 blue:.1 alpha:1] }        

    enumerateKeysAndObjectsUsingBlock:^(id name, id color, BOOL *s) {

    [list setColor:color forKey:name];
}];
like image 14
Alex Gray Avatar answered Nov 15 '22 16:11

Alex Gray