The short answer is that they are interchangeable.
I tend to use more of the yellow onions because they are often half the price of the red onions.
I like to use sweet Vidalia or Maui onions if I’m going to grill onions that are going to be eaten kind of on their own, or if I was going to make homemade onion rings.
The white ones have a bit more of a sharp, or strong taste to them. You can use a bit less of them in a fresh salsa than you would with the yellow onions, plus they make the salsa look prettier along with the diced red tomatoes and the green chilies.
Red onions pretty much have the same flavor as yellow onions, but they are so pretty that they make a nice addition to a salad, or pickled as a side dish. They also look nice sticking out of a grilled Portobello Mushroom Sandwich. They taste good raw.
You certainly can caramelize red onions, but the color tends to turn a little Grayish, but they taste just fine.
If I was roasting veggies along with onions, I would most likely use the yellow ones, so as not to end up with a funky color. The white ones might be a bit too pungent.
Here is some information about Onions including the ones that we didn’t yet discuss here, including ramps, pearl onions, spring onions, shallots, cippolini onions, scallions (green onions) and leeks. The only thing that seems odd on this site is that they say that white onions are sweeter and milder, which I completely disagree with. I find them much more assertive and sharp (in a good way).
Now for some recipes:
Pickled Red Onion and Red Cabbage
Pico de Gallo Salsa with White Onions
Roasted Root Vegetables with Sweet Onions
Beef Stew with Yellow Onions
Pickled Red Onions with Citrus
Pickled Ramps
Braised Green Onions
Leeks and Swiss Chard Quiche
Caramelized Cipollini Onions
Mushrooms with Shallots and Sherry
Grilled Spring Onions
Creamed Pearl Onions
Sweet Onions and Potatoes au Gratin
Onion Marmalade
Onion Cheese Soup
Japanese-style Onion Soup
Red Onion, Tomato and Red Wine Soup
Tequila Battered Onion Rings