Colloidal crystals and their derivatives possess photonic bandgap property, being useful in various applications, including structural coloration and colorimetric sensing. In this work, inverse opals made of a biodegradable polymer, poly(lactic-co-glycolic acid) (PLGA), are prepared to provide a controlled discoloration. To make PLGA inverse opals, a monolayer of silica particles is first deposited on the surface of PLGA film by spin coating, which is then partially embedded into the film by thermal annealing. Opal is deposited on the monolayer-coated PLGA film by dip coating and then embedded into the underlying PLGA film. Selective removal of silica particles leaves behind a face-centered cubic lattice of air cavity in PLGA matrix. The inverse opals whose framework is made of PLGA exhibit a pronounced structural color in dried state. When they are subjected to water, PLGA degrades by hydrolysis of ester groups, which results in the gradual discoloration. The discoloration rate is controllable by varying the pH of surrounding medium and cavity sizes, so that it can act as a colorimetric indicator of valid periods for drugs, foods, and cosmetics. In addition, high biocompatibility and unique optical appearance further render the inverse opals useful as edible anticounterfeiting materials for valuable drugs.