Heat a skillet over medium heat. Melt the butter in the skillet and add the onions. Cook until soft, then add the sugar, salt, pepper, thyme and dill. Cook until the onions are completely brown. Add the garlic cook another 1-2 minutes and add the vinegar. Remove from heat, discard the herb stems, and set aside until ready to use.