Yttrium and lanthanum hydride films with switchable optical properties