Indigo is unusual among colours in having both an unusually demanding chemistry and an unusually contested place in the list of spectral colours.
The dye is extracted from the leaves of Indigofera species in South Asia and Africa, and from woad, Isatis tinctoria, in Europe. Neither plant contains the blue directly. The leaves are steeped and fermented to release a precursor, and the dye is then applied in a reduced vat, in which it is soluble and yellow-green; the cloth comes out of the vat that colour and turns blue in the air as the dye oxidises. That transformation on contact with air is the reason indigo dyeing carries ritual and craft secrecy in several traditions, from West African resist dyeing to Japanese aizome.
The two sources were the same substance and were treated as rivals. European woad growers secured legislation against imported indigo, and the eventual victory of the Indian dye was reversed again by synthesis: Adolf von Baeyer worked out the structure in the late nineteenth century and industrial synthetic indigo displaced the crop.
The colour's place in the rainbow is a separate matter. Newton set out seven spectral colours in the Opticks, inserting indigo between blue and violet, and it is widely argued that he did so to reach seven, matching the notes of a scale and the classical planets, rather than because the band is distinct to the eye. Many people cannot reliably separate it from blue. The seven-colour rainbow taught in schools descends directly from that choice.