We have developed a photochemically controlled photonic-crystal material by covalently attaching spiropyran derivatives to polymerized crystalline colloidal arrays (PCCAs). These PCCAs consist of colloidal particles that self-assemble into crystalline colloidal arrays (CCAs), which are embedded in crosslinked hydrogels. Photoresponsive PCCAs were made two ways: 1) by functionalizing the hydrogel network with spiropyran derivatives, and 2) by functionalizing the colloidal particles with spiropyran derivatives. These materials can diffract light in the UV, visible, or near-IR spectral regions. The diffraction of the PCCAs is red-shifted by exciting the spiropyran with UV light. Alternatively, the diffraction is blue-shifted by exciting the spiropyran with visible irradiation. Thus, this material acts as a memory storage material where information is recorded by illuminating the PCCA and information is read out by measuring the photonic-crystal diffraction wavelength. UV excitation forms the open spiropyran form while visible excitation forms the closed spiropyran form. The diffraction shifts result from changes in the free energy of mixing of the PCCA system as the spiropyran is photoexcited to its different stable forms.