Polymers with switchable light transmission for coating surfaces