Why Do Nebulae Have Different Colors and What Causes the Hydrogen and Oxygen of the Nebulae To Glow?

There are three kinds of nebulae, based on the light they reflect.

Emission nebulae glow greenish-yellow and red. This is caused by the nearby presence of one or more extremely hot stars.

The ultraviolet radiation from the stars causes the hydrogen and oxygen of the nebulae to glow.

Reflection nebulae contain one or more cooler stars. Instead of the nebulae gases glowing, they reflect the bluish light emitted by the stars.

Emission and reflection nebulae can exist in the same nebula.

Dark nebulae have no nearby stars to light the gases. They appear as dark patches in the sky.