BLACK BODY RADIATION  reference

A "black body" is an idealized radiator. This is an object which absorbs all the radiation that falls upon it. It has zero reflectance. The absorbed energy can raise the black body's temperature. Eventually the black body's temperature is high enough so that the energy it radiates is equal to the energy it is absorbing, at which point its temperature stabilizes.
 
 
If we measure the total energy coming off the black body as a function of its wave length , that is its spectrum, we find that the wave length of the maximum energy output is given by the "Wien law"

Wien law     lm = 2.898 x 107 /T,
where  lm is the maximum wave length in Angstrom ( 10-8 cm), and T is the temperature in Kelvin.
  other black body equations

( http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Wien.html.  )

Although this object is an idealization, it is closely followed by stars, planets, etc. .  The first approximation we use to all celestial objects is that of the black body.

We are familiar with the phenomenon of different colors associated with different temperatures. Heat a metal bar and it begins to glow first red, then yellow, white, and finally blue at its higher temperature. The temperature is intimately connected with the color of the object.
(see table 13.4 in Kaler's book)
Stellar Class temperature(K) wave length at max. energy output for mid range
(Angstroms = 10-8 cm)
color to the human eye
O 28000 - 50000 743 blue
B 9900 - 28000 1529 blue-white
A 7400 - 9900 3350 white
F 6000 - 7400 4325 yellow-white
G, sun = G2 star 4900 - 6000 5317 yellow
K 3500 - 4900 6900 orange
M 2000 - 3500 10538 orange-red
none 300, room temperature 96600 black

In fact, the whole shape of the black body spectrum  as a function of temperature and wave length is known as can be seen from the diagrams from the Handbook of Astronomy and Aerospace   .
( http://adsbit.harvard.edu/books/hsaa/toc.html )

If we know the temperature of the black body then we can use the Stefan-Boltzmann law to find the power radiated for each square meter.

Stefan-Boltzmann law             P = sT4 , where s = 5.7 x 10-8 Watts/m2/K4 .
Boltzmann http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Boltzmann.html
 

In the diagram we have a star of radius R at a temperature T. The total power (energy/sec) radiated out of the small area is then

P x area. Since the total area of the sphere is 4piR2 , the total power radiated by the star is

Ptotal = 4piR2 x sT4 .
For example, for our Sun, R = 6.96 x 108m, T = 5780 K, then

Ptotal = 3.83 x 1026 Watts

The analysis of stellar spectra in the 1920's by Cecilia Payne-Gaposhkin demonstrated that the spectral sequence OBAFGKMNS was mainly due to temperature differences in the stars rather than to actual chemical differences. Stars are overwhelmingly made of hydrogen with traces of the heavier elements. Temperature differences between different categories of stars lead to different atomic ionization states (Saha equation) (states where electrons have been removed from the atoms leaving them with a net positive charge ) which is reflected in different probabilities for absorption of light. It was subsequently discovered that the temperature of the star depends basically on the mass of the star. The larger mass stars represent a greater conversion of gravitational potential energy into kinetic energy of motion of the atomic nuclei in the star's center. This larger kinetic energy has a dramatic effect on the ability of the star to support nuclear fusion reactions in its core. The greater the nuclear fusion rate, the more energy per second the star can emit into space.

Reference

Astronomy: A Brief Edition, James B. Kaler, Addisson-Wesley, 1997