Colloidal sphere, (111) cross-section
This 2D companion renders a flat cross-section through a close-packed FCC colloidal opal and drives the exact same Bragg-diffraction optics as the 3D version, computed from scratch on the canvas: interplanar spacing from sphere diameter, an effective refractive index from the packing fraction and medium, and a reflected wavelength from Bragg's law that is then converted to a real displayed RGB color through a hand-written wavelength-to-RGB routine — no pigment, no lookup table, just the physics. Sweep the diameter slider to change hue, or the viewing-angle slider to watch the same lattice blue-shift its reflected color exactly as real opal iridescence does, while a live chart traces the full λ(θ) curve.