What's the difference between green, white, and red onions?
The most significant difference is between green onions, and other onions.  As you probably know, green onions are the stalks that grow from the bulbs of regular onions.  They have a grassy, vegetal flavor with a hint of pungency, but do not taste anything like the bulbs.  Green onions are often harvested from smaller varieties of onion than are cultivated for the bulbs, but can be from any variety.

Any recipe expecting green onions is going to specifically indicate this, and in that case, you should use them.  In this sense, green onions are a completely different item than "onions" which implies the root bulb.  This is much like the fact that coriander roots and leaves are very different, despite coming from the same plant, and are not generally substituted for one another.

Green onions are extremely popular in Asian cuisines, but are also used in many western recipes.



There are many varieties of culinary alliums, including garlic, scallions, leeks, shallots; red, white, yellow onions; and even the sweet onion varieties like Videlia.  Each of these varieties brings a subtle nuance or flavor.  

Some recipes are traditionally made with a particular type of allium (such as leek and potato soup) and will call for that variety.

When just "onion" is specified, you can freely use red, white, or yellow, depending on what is plentiful in your region.  Where I live, all three colors of onion are readily available, but yellow are the most popular and least expensive.  As an overall generalization (and it depends on where the onion was grown, and what variety it is, so there is considerable variation and many exceptions):


Yellow onions are the basic, generic onion of Western European and North American style cooking (although in many French dishes, shallots are popular).   They tend to have the most "crying" factor, and the strongest aroma.  For onions that will be sweated, cooked down, or caramelized, this is often the onion of choice.
White onions tend to have a less sulfurous bite than yellow, and often have a somewhat milder flavor.  This is the traditional onion of Mexican cuisine, and performs very well in raw applications, and in salsas.  White onions tend to have the firmest, smoothest texture.
Red onions tend to have the most mild flavor, a slightly rougher texture, and are often used in raw or pickled applications, where their attractive red color stands out.  


You will find that even different authors present different descriptions of the various onion varieties, which probably reflects more on what they have in their region, and the great variation than it does anything else.  For example:  National Onion Association,  The Kitchn, The Cooking Dish.

To a great extent, the type of onion used in a given recipe may be freely substituted; rarely, will you have a huge difference in flavor or outcome.   Most often, the choice is determined by your local market conditions&mdash;here in the Eastern US, yellow onions are the least expensive, so that is what we use the most of.

The best answer I can give to your question is:  


Use green onions where they are called for specifically, otherwise use a regular onion.   Think of them as a different vegetable than plain "onions."
If you are cooking a North American or Western European recipe, and the preferred variety of "onion" is not specified, yellow is the default choice, but use what you have available to you at a reasonable price and there will be only minor difference in outcome.


There is no application I am aware of where you absolutely must use a specific onion or the recipe will fail.