Halochromism of a polythiophene derivative induced by conformational changes and its sensing application of carbon dioxide.