A serendipitous discovery by a graduate student has led to materials that quickly change color from completely clear to a range of vibrant hues — and back again.