Its rainbow is built from glass beads, not pigment
A precious opal has no dye in it. Its fire comes from millions of microscopic silica spheres, each only about 150 to 300 nanometers wide, stacked in a regular three-dimensional grid. That grid is the right spacing to bend visible light, so it splits white light into moving flashes of color. It is a natural photonic crystal, and the size of the spheres decides which colors you see.