Slowly cooking the onions will caramelise them, which brings out the sweetness and gives them a brown color.