Tuesday, February 16, 2010

Create a Custom Icon for Your HotCocoa App

If you've written an application for Mac OS X in HotCocoa, one of the first things you probably want to do is to change the icon. This is simple to do, but I didn't see it documented anywhere.

The following process uses tools freely available for OS X (I use OS X 10.6.2) to create and change the icon.

First, grab Seashore if you need an image editor. If you have a non-rectangular image and want to use a transparency, use the tip here. If you want it to look like the rest of the icons, see Icons in the Apple Human Interface Guidelines document on Apple's site. If you have photoshop you could try something like this. But, unless you need it to look professional, just save the image.

Open Img2icns and drag the image into it. The free version works fine for this, but I recommend buying the pro version, even if only to fund their development. You can tell where the transparency will be in the icon by where you see the blueish background within the area. Then click on Icns in Img2icns to create the icns file.

Copy that file to the resources directory in your HotCocoa project and name it (name of app).icns. If you are not sure what to name it, look in the built application (after calling macrake) that resides in (name of app).app/Contents/Resources/. By default the HotCocoa macrake build copies HotCocoa.icns to (app name).icns unless you provide a (name of app).icns in the (project name)/resources directory.

Call macrake and see the new icon for your app! If you already had your app in the dock, you might need to remove it from the dock to see the icon change.

No comments: