Stacking faults appear to be the most common type of defect in inverted opa
ls which are good candidates for photonic crystals with absolute gaps in th
e visible range of light. In this Letter we present for the first time a sy
stematic study of the effect of stacking faults on the optical properties o
f self-assembled photonic crystals, by means of large-scale transmittance c
alculations for macroscopic slabs of inverted opals with randomly distribut
ed stacking faults. We show that frequency gaps, as seen in optical transmi
ssion experiments, will in general appear wider in the presence of stacking
faults. We attribute the above to Anderson localization of light due to di
sorder.