Preheat your oven to 350°F.
Grease a 13x9-inch baking dish lightly.
Melt the butter over medium heat in a large skillet.
Add the chopped onion and cook, stirring occasionally, until tender, about 5-6 minutes.
Sprinkle the onions with flour and stir for 2 minutes.
Gradually whisk in the milk, stirring frequently for 8-10 minutes until the mixture thickens.
Stir in the Parmesan and Cheddar cheeses with salt and pepper until smooth.
Layer half the sliced potatoes in the baking dish, pour half the cream sauce over them, and repeat layers.
Cover and bake for 45 minutes, then uncover and bake until golden brown and tender, about 15 more minutes.
Let stand for 5 minutes before serving. Garnish with fresh chives if desired.