Pantone For Mac
For a long time now I have wanted to have a full set of Pantone swatches in the Mac OSX color picker. I searched for a quick solution online but never found anything. So in the end I realised that if this was going to happen I would have to do something about it myself Pantone Swatches in the Mac OSX Color Picker Stage 1 – getting a list of swatchesWhilst it’s very easy to create a custom color palette and add your own colors to it I had no particular desire to try and enter an entire Pantone swatch book by hand. A quick search online revealed several sites with lists of swatches and their respective rgb values. So that’s great – the difficult part has already been done by someone else!
I checked out a few lists and in the end settled on this one: which gave a full set with hex and rgb values laid out in a just perfect for scraping with php. Stage 2 – scraping the data into a databaseThe next task was to get the data off the webpage and into a database. For tasks like this I always use.
It’s very easy to learn – and makes this kind of task very simple.Before writing a script to scrape the data I set up a myqsl database ‘pantoneswatches’ with a table ‘coatedswatches’ to hold the data. Enabling option key shortcuts in matlab for mac. The table structure was as follows.
Sep 10, 2009 Capture your world in PANTONE Color, build and create palettes to test on 3D-rendered materials & designs, and share PANTONE Colors with your Creative Cloud® account, clients, and social networks. Free multiplayer online fps games for mac. Subscribers get access to all PANTONE Colors.
CREATE TABLE `coatedswatches` (`id` int(11) unsigned NOT NULL AUTOINCREMENT,`name` varchar(50) DEFAULT NULL,`hex` varchar(7) DEFAULT NULL,`red` varchar(5) DEFAULT NULL,`green` varchar(5) DEFAULT NULL,`blue` varchar(5) DEFAULT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;At this point I wasn’t really sure if I needed the rgb values or the hex values so I decided to get everything just in case.Now, with the database ready it was time to scrape the data. I wrote the following php script making use of PHP Simple HTML DOM Parser to sort through each table row ( ) and get the text content from each table data cell ( ) and inset as a row in the database. list setColor:NSColor colorWithRed:0.996 green:0.867 blue:0 alpha:1.0 forKey:@'Pantone Yellow C';list setColor:NSColor colorWithRed:1 green:0.843 blue:0 alpha:1.0 forKey:@'Pantone Yellow 012 C';list setColor:NSColor colorWithRed:0.996 green:0.314 blue:0 alpha:1.0 forKey:@'Pantone Orange 021 C';// etc// etc// etcStage 4 – using Xcode to generate the.clr fileTo generate the final.clr file I opened Xcode and created a new project of type Cococa Application. Once this was ready I opened the AppDelegate.m file and where the comment ‘// Insert code here to initialize your application’ appeared in the – (void)applicationDidFinishLaunching:(NSNotification.)aNotification method I replaced it with the following. NSColorList.list = NSColorList.alloc initWithName:@'Pantone Coated';/. COPY AND PASTE THE GENERATED LIST OF COLORS HERE./list writeToFile: NSHomeDirectory stringByAppendingPathComponent:@'Library/Colors/';Once that was done I did a build and run and as soon as the application had launched I checked out the contents of my /Library/Colors/ folder to see a new Pantone Coated.clr file.
The next thing to do was open an app ( Sketch.app) and then open the color picker to check out the new color palette! Using Pantone swatches in Sketch ConclusionIn hindsight the way I went about this was perhaps more lengthy that it could have been. There’s no reason why I couldn’t scrape the page and generate the objective-c code all in one step missing out the database. But as I was not sure how to proceed it seemed better to store the data then work out what to do next. Anyway here’s a short example that does just that.