Add templateM8-legend to palette-loop

Inside the foreach palette-loop the templateM8-legend was missing. This caused a visual error in the templateM8-section in the backend.