Regarding some varieties of red onion which seem to contain a chemical that reacts with heat (or something) to turn the onions rather an ugly purple - almost black - when cooked this way, I know they are called sweet red onions and sometimes Italian onions but they are not the variety favored by the Italians I know.
The variety I use is different, is stronger for one thing, and doesn't turn very dark when cooked. It remains about the color of cranberry sauce. The shape is different, the growing season length is different (longer) and even the stems look different. I buy them at the local produce (farmers) market that buys mostly locally grown stuff. These onions are planted in the early summer and are being harvested now so there are plenty in the market.
The Italian people use them to make pickles and pickled eggs, which turn out a beautiful rose-pink.