Mode-locked multichromatic x rays in a seeded free-electron laser for single-shot x-ray spectroscopy