While I haven’t tried it myself, I don’t see why not! Because the base of the pan is wider than the top, you may want to use a little less batter for whichever color you will be pouring in first.  Otherwise, the layers of your 4th of July cake may be different heights once baked.