Beetles are almost as popular among insect collectors as butterflies, partly because of their bright diffraction colors. The play of color in opal is also due to diffraction of a most amazing sort. Technically, opal is not a mineral, but a mineraloid, a non-crystalline misture of silica and water. When they are regular in size and stacking, they produce the colors of precious opal. Most colors are due to various absorption mechanisms, where some wavelengths of light are absorbed but others are not.
Absorption is due to interactions between photons and electrons.
The outermost electrons in atoms are often lost to ionization. Innermost electrons are too tightly bound to the nucleus to be excited by anything short of X-rays. Most orbital electrons are paired and too tightly bound to be affected by visible light. Only unpaired electrons are loosely enough bound to interact with visible light photons. Individual atoms emit and absorb characteristic wavelengths of light.