Their color derives from flaws in the gem's carbon structure: some of the carbon atoms have been replaced by an element, such as boron, that emits or absorbs a specific color of light.Once scientists learned how to create synthetic diamonds, they found that they could selectively alter a diamond's optical properties by injecting impurities.