Solar heating of a cometary surface provides the energy necessary to sustain gaseous activity, through which dust is removed1,2. In this dynamical environment, both the coma3,4 and the nucleus5,6 evolve during the orbit, changing their physical and compositional properties. The environment around an active nucleus is populated by dust grains with complex and variegated shapes7, lifted and diffused by gases freed from the sublimation of surface ices8,9. The visible colour of dust particles is highly variable: carbonaceous organic material-rich grains10 appear red while magnesium silicate-rich11,12 and water-ice-rich13,14 grains appear blue, with some dependence on grain size distribution, viewing geometry, activity level and comet family type. We know that local colour changes are associated with grain size variations, such as in the bluer jets made of submicrometre grains on comet Hale–Bopp15 or in the fragmented grains in the coma16 of C/1999 S4 (LINEAR). Apart from grain size, composition also influences the coma’s colour response, because transparent volatiles can introduce a substantial blueing in scattered light, as observed in the dust particles ejected after the collision of the Deep Impact probe with comet 9P/Tempel 117. Here we report observations of two opposite seasonal colour cycles in the coma and on the surface of comet 67P/Churyumov–Gerasimenko through its perihelion passage18. Spectral analysis indicates an enrichment of submicrometre grains made of organic material and amorphous carbon in the coma, causing reddening during the passage. At the same time, the progressive removal of dust from the nucleus causes the exposure of more pristine and bluish icy layers on the surface. Far from the Sun, we find that the abundance of water ice on the nucleus is reduced owing to redeposition of dust and dehydration of the surface layer while the coma becomes less red.