1. Preheat oven to 375degreesF. Spray a 9-by-5- inch loaf pan with vegetable cooking spray.
2. Heat 1 Tbsp. of the oil in a large nonstick skillet over medium heat. Addonion and cook until just beginning to brown, about 5 to 7 minutes. Remove fromheat and let cool a few minutes.
3. Whisk flour, sugar, baking powder, salt, pepper, and rosemary together in a large bowl. Add beer and onion and stir until combined. Pour into loaf pan and drizzle remaining 1 Tbsp. oil over the top of the batter. Bake at 375degreesF until top is golden and a toothpick inserted into the center of the loaf comes out clean, 45 to 55 minutes.
4. Cool bread in pan for 5 minutes, then transfer to a cooling rack and cool completely before slicing. Bread tastes best at room temperature or toasted.