Environmentally responsive nanoparticle-based luminescent optical resonators.