It has been an industry wide practice to adopt yellow as the primary colour of heavy equipment.
However this isn’t the norm and there is no standard requiring this to be the case.
There are plenty of manufacturers that have distinct colours for their heavy machinery/equipment.
Hitachi, for instance, paints their excavators ‘Safety orange’.
Yellow is primarily treated as the color of caution and visibility. Since all the heavy machinery which are employed in the mines or construction sites must be handled with utmost care, they are provided with yellow colour.
The point is – there has to be a stark contrast with the work environment so as to caution bystanders/ vehicles nearby about the presence of these machines. It’s a safety thing. There are reflectors and reflective tapes that are pasted to this end.