Around 4000 BBY, lightsaber crystals were used to indicate a Jedi’s chosen class. Blue indicated a Jedi Guardian, a Jedi who used the Force on a more physical level. Green indicated a Jedi Consular, a Jedi who preferred to reflect on the mysteries of the Force and fight the dark side at its heart. Yellow indicated a Jedi Sentinel, a Jedi who honed his or her skills in a balance of combat and scholarly pursuits.
This distinction fell out of practice in later years, when most Jedi used blue or green crystals from Ilum caves based on personal choice, and then the use of crystals coming from various source worlds became marginal. However, specific roles like the temple guards all used yellow crystals to power their lightsabers. Purple and orange crystals were still used by some Jedi until the fall of the Jedi Order, but they were exceedingly rare, and often passed down through generations. During the Galactic Civil War, the Galactic Empire banned trade and possession of all lightsaber crystals. No longer having Ilum crystals at their disposal, Jedi of the New Jedi Order settled for the use of various crystals and gems, creating lightsaber blades of multiple colors.
The synthetic crystals, favored by users of the dark side for their offensive properties, were filled with the negative energies of their creators, which gave the crystals their red color; the majority of the Sith and Dark Jedi wielded crimson-bladed lightsabers, though colors similar in hue to red, such as orange and magenta, were not unheard of.