Getting colours in code right
Getting colours into source code is generally a pain – you need to either keep guessing the red, green, and blue component values of the colour you’re interested in and then get that into the number base correct for your language of choice, or you know these values and have to manually translate them. But things have recently got a lot better in my workflow thanks to Developer Picker and my graphics tool of choice, Pixelmator supporting HTML colour formats:
On the left is Developer Picker, which is a plugin that’ll work in any application on the Mac that uses the standard colour picker widget. It lets you copy the currently selected colour to the clipboard in either Cocoa NSColor or UIColor object format, C CGColorRef format, or HTML and CSS format. Here’s the output of the above colour outputted ready for use in Cocoa/Objective C:
NSColor *aColor = [NSColor colorWithCalibratedRed:0.347 green:0.447 blue:0.563 alpha:1.000];
So easy! No fiddling around with a calculator :)
The second picker is from Pixelmator 1.5, which has just come out. This update has a host of features aimed at making it easier to build web page designs, including it’s own HTML colour picker.