Many chameleons, and panther chameleons in particular, have the remarkable ability to exhibit complex and rapid colour changes during social interactions such as male contests or courtship. It is generally interpreted that these changes are due to dispersion/aggregation of pigment-containing organelles within dermal chromatophores. Here, combining microscopy, photometric videography and photonic band-gap modelling, we show that chameleons shift colour through active tuning of a lattice of guanine nanocrystals within a superficial thick layer of dermal iridophores. In addition, we show that a deeper population of iridophores with larger crystals reflects a substantial proportion of sunlight especially in the near-infrared range. The organization of iridophores into two superposed layers constitutes an evolutionary novelty for chameleons, which allows some species to combine efficient camouflage with spectacular display, while potentially providing passive thermal protection.