Color is related to temperature via the Blackbody Law. In the early 1900's astronomers found that stars could be classified via the strength of different absorption lines in the spectra. Some stars had many Hydrogen Lines, some had none. Some stars had many lines from calcium, some had none. Astronomers grouped the stars according to their spectral line strengths O, B, A, F, G, K, M O, B, A, F, G, K, M This is the spectral classification O stars are blue and hot.
M stars are red and cold.
Luminosity Blackbodies have a special relationship between their energy output and their temperature. T 4 where R is the radius of the star and T is its temperature. In this diagram Barnards star and Betelgeuse have the same T but the differ in L by 7 orders in magnitude. Using the L proportional to R 2 T 4 relation Betelgeuse must have much larger radius. Stars below the Main Sequence are Dwarfs.