Change colour of an image w/ PHP GD

I'm currently building a fairly basic t-shirt design site, which lets people pick a t-shirt colour, a template, font, and imprint colour, which thus far is working fine.

It uses a combination of javascript and PHP GD to output the image as they construct it. You can see it here.

What happens is that it overlays a PNG of whatever design template they choose over top of the shirt. Is there a way that I can create just a black template PNG file, and change the colour of it with PHP GD? If so, what is the method for it?