A planetary nebula is a glowing shell of gas and plasma ejected by certain types of stars during the later stages of their evolution. Despite the name, they have nothing to do with planets. The term "planetary" was coined by early astronomers who mistook these nebulae for planets due to their round, planet-like appearance when viewed through telescopes.
Planetary nebulae are formed when a star, similar in size to our Sun, exhausts its nuclear fuel and begins to shed its outer layers. As the core of the star contracts, the outer layers are expelled, forming a glowing shell of ionized gas and dust. The ultraviolet radiation from the exposed hot core illuminates the gas, creating the spectacular nebulae we observe.
Planetary nebulae come in a variety of shapes and sizes, from spherical to elliptical and even bipolar. They often exhibit intricate and beautiful patterns, with filaments, knots, and jets of material. The colors of planetary nebulae are due to the ionization of different elements in the gas, with red and green hues predominating.