Why is the sun classified as a G2?

Its stellar classification, based on spectral class, is G2V, and is informally designated a yellow star, because its visible radiation is most intense in the yellow-green portion of the spectrum.[13] In this spectral class label, G2 indicates its surface temperature of approximately 5,778 K (5,505 °C; 9,941 °F)

from en.wikipedia. org/wiki/Sun