This study reports unconventional, all-room-temperature shape memory (SM) effects using templated macroporous shape memory polymer (SMP) photonic crystals comprising a glassy copolymer with high-glass transition temperature. "Cold" programming of permanent periodic structures into temporary disordered configurations can be achieved by slowly evaporating various swelling solvents (e.g., ethanol) imbibed in the interconnecting macropores. The deformed macropores can be instantaneously recovered to the permanent geometry by exposing it to vapors and liquids of swelling solvents. By contrast, nonswelling solvents (e.g., hexane) cannot trigger "cold" programming and SM recovery. Extensive experimental and theoretical investigations reveal that the dynamics of swelling-induced plasticizing effects caused by fast diffusion of solvent molecules into the walls of macropores with nanoscopic thickness dominate both "cold" programming and recovery processes. Importantly, the striking color changes associated with the reversible SM transitions enable novel chromogenic sensors for selectively detecting trace amounts of swelling analytes mixed in nonswelling solvents. Using ethanol-hexane solutions as proof-of-concept mixtures, the ethanol detection limit of 150 ppm has been demonstrated. Besides reusable sensors, which can find important applications in environmental monitoring and petroleum process/product control, the programmable SMP photonic crystals possessing high mechanical strengths and all-room-temperature processability can provide vast opportunities in developing reconfigurable/rewritable nanooptical devices.