Monday July 25, 2011

Generate Colored Icons From Image Masks In Objective-C

Ole Zorn forked and improved on a nifty method created by Marco Arment of Instapaper fame. It takes a UIImage and treats it as a mask to fill it’s opaque parts with a solid color. Marco uses it to generate arbitrarily colored icons on the fly. Ole took his original idea and simplified it.

This is also a great example of how gists work. A gist is snippet of code posted online (publically or privately) similar to Pastie. The killer feature, though, is that you have a full history of changes to that snippet and can even fork a snippet keeping the full history of it’s lineage. If you want to see Marco’s original method before Ole improved it, just click the oldest revision in the right sidebar.

Powered by git, of course.