When we read recipes that say fry onions in a little oil till brown, there is much more to this simple sentence. The onions undergo some physical changes to change the colour. Onions are best cooked in a small amount of fat and best done in an uncovered pan. As fat reaches higher temperatures than water, cooking usually occurs quickly and you can easily see the onions become translucent as they move from raw to cooked. As heat softens the structure of the onions, the fat not only captures the flavours being released, but also contributes to new flavours being formed through the process of browning. There is another technique to cook onions, which in English would be called ‘sweating’. This process of releases flavours with moisture and low temperatures. Fat, in this case, is used just to hold the non-volatile flavours as they are released from the onion. No browning takes place. The pan is covered so the lid traps steam, which condenses and drips back on to the onions. The onions soften and release their moisture and flavour at a very slow pace so the onions cook in their own juices.
When we fry onions in oil or ghee, some of it is also absorbed by the onion. So, frying adds deeper flavours and richer colours to the finished dish.