Why do red onions turn blue or green when cooking sometimes? I cooked a pot of beans with some red onions last night.  Today for lunch when I got them out of the fridge, all of the onions had turned a blue/green colour!

They still taste ok, but sure looks unappetizing!

Any ideas what's going on here?
The pigments that give onions the colour behave like a litmus test. They are red in the naturally acidic onion. They turn green/blue in an alkaline environment. It sounds like when you cooked the beans it created that alkaline environment to cause the colour change.

See Here.