Preheat oven to 350°F (175°C) and line a muffin tin with cupcake liners.
Mix Dry Ingredients: Whisk flour and baking powder in a bowl to distribute evenly.
Cream Butter & Sugar: Beat butter and sugar until fluffy. Add eggs one at a time, then mix in vanilla, key lime zest, and juice.
Combine Wet & Dry: Gradually mix in the flour mixture, alternating with buttermilk. Stir gently, then add food coloring if using.
Bake: Fill liners ⅔ full and bake for 18-20 minutes until a toothpick comes out clean. Cool completely before filling and frosting.
Make the Filling: Mix cream cheese, powdered sugar, and key lime juice until smooth.
Prepare the Frosting: Beat butter and cream cheese until creamy. Add powdered sugar, key lime juice, and vanilla, then beat until fluffy.
Fill & Frost: Cut a small hole in each cupcake, fill with cream cheese mixture, then pipe frosting on top. Sprinkle with green sugar and garnish with a lime slice.