In Universe exist many stars, trillions of stars and many types of stars. Not all stars are like our sun. Some stars are more bigger than the sun, other more small than the sun.
The spectral class of a star is a designated class of a star describing the ionization of its chromosphere, what atomic excitations are most prominent in the light, giving an objective measure of the temperature in this chromosphere. Light from the star is analyzed by splitting it up by a diffraction grating, subdividing the incoming photons into a spectrum exhibiting a rainbow of colors interspersed by absorption lines, each line indicating a certain ion of a certain chemical element. The presence of a certain chemical element in such an absorption spectrum primarily indicates that the temperature conditions are suitable for a certain excitation of this element. If the star temperature have been determined by a majority of absorption lines, unusual absences or strengths of lines for a certain element may indicate an unusual chemical composition of the chromosphere.
Stars are currently classified using the letters O, B, A, F, G, K and M, where O stars are the hottest and the letter sequence indicates successively cooler stars up to the coolest M class. According to an informal tradition, O stars are "blue", B "blue-white", A stars "white", F stars "yellow-white", G stars "yellow", K stars "orange", and M stars "red".
the current star classification system, the Morgan-Keenan system, the spectrum letter is enhanced by a number from 0 to 9 indicating tenths of the range between two star classes. Another dimension that is included in the Morgan-Keenan system is the luminosity class expressed by the Roman numbers I, II, III, IV and V, expressing the width of certain absorption lines in the star's spectrum. It has been shown that this feature is a general measure of the size of the star, and thus of the total luminosity output from the star. Class I are generally called supergiants, class III simply giants and class V either dwarfs or more properly main sequence stars.
Class O stars are very hot and very luminous, being bluish in color; in fact, most of their output is in the ultraviolet range. These are the rarest of all main sequence stars. About 1 in 3,000,000 of the main sequence stars in the solar neighborhood are Class O stars.
Class B stars are extremely luminous and blue. Their spectra have neutral helium, which are most prominent at the B2 subclass, and moderate hydrogen lines. Ionized metal lines include Mg II and Si II.
Class A stars are amongst the more common naked eye stars, and are white or bluish-white. They have strong hydrogen lines, at a maximum by A0, and also lines of ionized metals (Fe II, Mg II, Si II) at a maximum at A5.
Class F stars have strengthening H and K lines of Ca II. Neutral metals (Fe I, Cr I) beginning to gain on ionized metal lines by late F. Their spectra are characterized by the weaker hydrogen lines and ionized metals. Their color is white.
Class G stars are probably the best known, if only for the reason that our Sun is of this class. About 1 in 13 of the main sequence stars in the solar neighborhood are Class G stars.
Class K are orangish stars which are slightly cooler than our Sun. Some K stars are giants and supergiants, such as Arcturus, while orange dwarfs, like Alpha Centauri B, are main sequence stars. They have extremely weak hydrogen lines, if they are present at all, and mostly neutral metals (Mn I, Fe I, Si I). By late K, molecular bands of titanium oxide become present. About 1 in 8 of the main sequence stars in the solar neighborhood are Class K stars. There is a suggestion that K Spectrum stars are very well suited for life.
Class M is by far the most common class. About 76% of the main sequence stars in the solar neighborhood are Class M stars. Although most Class M stars are red dwarfs, the class also hosts most giants and some supergiants such as Antares and Betelgeuse, as well as Mira variables. The late-M group holds hotter brown dwarfs that are above the L spectrum.
Our sun for example, has the spectral type G2V ('yellow' two tenths towards 'orange' main sequence star).