<P> In astronomy, stellar classification is the classification of stars based on their spectral characteristics . Electromagnetic radiation from the star is analyzed by splitting it with a prism or diffraction grating into a spectrum exhibiting the rainbow of colors interspersed with spectral lines . Each line indicates a particular chemical element or molecule, with the line strength indicating the abundance of that element . The strengths of the different spectral lines vary mainly due to the temperature of the photosphere, although in some cases there are true abundance differences . The spectral class of a star is a short code primarily summarizing the ionization state, giving an objective measure of the photosphere's temperature . </P> <P> Most stars are currently classified under the Morgan - Keenan (MK) system using the letters O, B, A, F, G, K, and M, a sequence from the hottest (O type) to the coolest (M type). Each letter class is then subdivided using a numeric digit with 0 being hottest and 9 being coolest (e.g. A8, A9, F0, and F1 form a sequence from hotter to cooler). The sequence has been expanded with classes for other stars and star - like objects that do not fit in the classical system, such as class D for white dwarfs and classes S and C for carbon stars . </P> <P> In the MK system, a luminosity class is added to the spectral class using Roman numerals . This is based on the width of certain absorption lines in the star's spectrum, which vary with the density of the atmosphere and so distinguish giant stars from dwarfs . Luminosity class 0 or Ia+ is used for hypergiants, class I for supergiants, class II for bright giants, class III for regular giants, class IV for sub-giants, class V for main - sequence stars, class sd (or VI) for sub-dwarfs, and class D (or VII) for white dwarfs . The full spectral class for the Sun is then G2V, indicating a main - sequence star with a temperature around 5,800 K . </P> <P> The conventional color description takes into account only the peak of the stellar spectrum . However, in actuality stars radiate in all parts of the spectrum, and because all spectral colors combined appear white, the actual apparent colors the human eye would observe are far lighter than the conventional color descriptions would suggest . This means that the simplified assignment of colors of the spectrum can be misleading . Excluding color - contrast illusions in dim light, there are no green, indigo, or violet stars . Red dwarfs are a deep shade of orange, and brown dwarfs do not literally appear brown, but hypothetically would appear to be a dim grey to a nearby observer . </P>

Sun is classified as what type of star