Electrochemical copolymerization of N-methylpyrrole (NMPy) and cyclopenta[2,1-b:3,4-b′]dithiophene (CPDT) was performed in acetonitrile containing sodium perchlorate as a supporting electrolyte. Characterization of the resultant copolymer P(CPDT-co-NMPy) was performed by cyclic voltammetry, UV–vis spectroscopy, Fourier transform infrared spectroscopy and scanning electron microscopy. The P(CPDT-co-NMPy) film has distinct electrochromic properties and exhibits four different colors (reddish brown, pale khaki, pale sea green and light blue) under various potentials. The maximum contrast (ΔT%) and response time of the copolymer film at 750 nm were measured as 47.0% and 2.20 s, respectively. An electrochromic device (ECD) based on P(CPDT-co-NMPy) and poly(3,4-ethylenedioxythiophene) was constructed and characterized. The optical contrast (ΔT%) at 630 nm was found to be 40.2%, and the response time was measured as 1.77 s. The coloration efficiency of the device was calculated to be 476 cm2 per C at 630 nm. The ECD also has satisfactory optical memories and redox stability. UV–vis spectra of (a) poly(N-methyl pyrrole) (PNMPy), (b) P(CPDT-co-NMPy) and (c) PCPDT deposited onto indium-tin-oxide-coated at the neutral state. Insets: (A) light yellowish green, (B) reddish brown, (C) purple are de-doped films, and (A′) pale cyan, (B′) light blue, (C′) blue are doped films of PNMPy, P(CPDT-co-NMPy) and PCPDT, respectively. The different electrochromic properties of the three polymers confirmed the occurrence of copolymerization between NMPy with CPDT