Photonic crystal (PC) films are prepared by precipitation of colloidal crystal seeds in supersaturated solution of particles, followed by crystal growth and structure fixing with photo-polymerization. As the liquid monomer becomes a solid matrix, the highly concentrated particles are forced to precipitate into colloidal microcrystals in short time, and ‘polymerization-induced colloidal assembly’ (PICA) is shown to be the major driving force to form colloidal crystals. PICA is intrinsically different from evaporation-induced colloidal assembly, because the seed formation and crystal growth are separated into two independent steps, which makes the synthesis more flexible, controllable, and efficient. The PICA process is capable of quickly producing PC films with an ultra-narrow bandgap, tunable thickness, and large size. Based on these characteristics and the blocking effect of the outer PC layer to the reflection signal of inner layer, a coding–decoding system is developed in which the film's composition and stacking sequence can be identified by its distinctive reflection spectrum.