Preheat oven to 350°F (175°C). Line a cupcake pan with liners.
In a bowl, whisk together flour, baking powder, and salt. Set aside.
In a large bowl, beat butter and sugar until light and fluffy.
Add eggs one at a time, mixing well after each addition. Stir in vanilla extract.
Alternately add dry ingredients and milk, mixing until just combined.
Divide batter evenly into six small bowls.
Add a few drops of different food coloring to each bowl to create the rainbow colors.
Spoon small amounts of each colored batter into cupcake liners, layering them to create a rainbow effect.
Bake for 18 minutes or until a toothpick inserted in the center comes out clean.
Let cupcakes cool completely before frosting.
For the frosting, beat butter until creamy, then gradually add powdered sugar.
Stir in milk and vanilla extract, mixing until smooth.
Spread or pipe frosting onto cooled cupcakes. Add sprinkles if desired.