Is it safe to cook in discolored stainless steel pots?
If the pan has been always used in the kitchen and for cooking,

then is absolutely safe.

The phenomenon you observe is due to thin film interference. Is the same iridescence that we observe on soap bubbles or where a thin film of a greasy matter spread on a water surface. 

In the pan case, the thin film causing the interference and the related coloured fringes is formed by metal oxides already present in the pan. Actually these oxides are exactly what makes the steel of the pan stainless and resistant to corrosion. 

The phenomenon can be amplified if the pan has been overheated for instance while sauting to dryness. 

The rainbow might be an annoyance but does not compromise your pan nor the quality of your food. 

For those onto the physics and chemistry of this here are two possible starting links:

https://www.scientificamerican.com/article/why-doesnt-stainless-stee/

https://en.m.wikipedia.org/wiki/Thin-film_interference

In principle a thin layer of grease/oil can give the same effect. This is obviously not the case for a washed pan.

EDIT: As for OP mentioned a stainless steel pan I forgot to say that obviously also a non homogeneous thickness of reticulated fat can lead to fringes or spot in a seasoned iron pan.