Blue–violet spectral evolution of young Magellanic Cloud clusters