The colours of stars
A curse of being a stellar astronomer is that we can never truly see the stars that we study, at least not in the way we perceive the Sun. But it is only a natural question to ask, what do other stars truly look like? Fortunately this question can be answered using a combination of spectroscopic data, stellar models, and colour science. Since early in my career, the question of the visual appearance of white dwarfs has fascinated me, and so I set out to answer this question myself, finding some surprising results.
Black Bodies and Stars
An object that perfectly absorbs all radiation is known as a black body. Since it is a perfect absorber it must also be a perfect emitter of radiation, displaying a Planckian spectral energy distribution:
\[B_\lambda(\lambda, T) = \frac{2hc^2}{\lambda^5} \frac{1}{\exp\left(\frac{hc}{\lambda k_B T}\right) - 1},\]where the only variable is temperature. As a black body becomes hot enough to be visibly luminous, it will transition through perceived colours of red, orange, white, and eventually blue. No other colours are possible for true black bodies.
Stars are not perfect black bodies as their outer layers absorb some wavelengths more strongly than others. However, their deviations away from black bodies (primarily absorption lines that absorb over a narrow wavelength range) have a relatively minor effect, and so to first approximation main sequence stars (including the Sun) closely resemble black bodies in visual appearance. Therefore main sequence stars are limited to colours of orange for cool stars (M and K dwarfs), white for Solar-like stars (G and F dwarfs), and blue for hot stars (A, B, O stars).
White Dwarfs
White dwarfs can have atmospheres that are much denser than main sequence stars, and is particularly true for cool, helium-dominated atmospheres, which can reach liquid densities of up to $1\,\mathrm{g}\,\mathrm{cm}^{-3}$. The result is extreme spectral broadening of atomic lines and molecular bands, potentially resulting in absorption over $>100\,\mathrm{nm}$ wavelength ranges. I was therefore curious whether these broad absorption features (some of which occur in the center of the optical) could cause their perceived colours to noticeably deviate from black bodies.
Colour Science
Although the human experience of colour is fundamentally a subjective one, it is also possible to specify colour in a quantitative way. This is the domain of colour science, without which we could not calibrate lighting, cameras, computer displays, etc. For our purposes, colour science allows us to convert a stellar spectrum into a quantitative description of colour called the chromaticity. A specific chromatcity can then be replicated, by converting to the sRGB colour space so that it can be displayed on a computer monitor.
If we have a spectrum $F_\lambda(\lambda)$ and want to calculate its displayable RGB colour. Mathematically we do something akin to synthetic photometry in astronomy:
\[X = \int F_\lambda(\lambda) \bar{x}(\lambda) \,\mathrm{d}\lambda \qquad Y = \int F_\lambda(\lambda) \bar{y}(\lambda) \,\mathrm{d}\lambda \qquad Z = \int F_\lambda(\lambda) \bar{z}(\lambda) \,\mathrm{d}\lambda,\]where $\bar{x}(\lambda)$ etc, are the CIE 1931 colour matching functions, and $X,Y,Z$ are the integrated fluxes in the XYZ colour space. But what if we want to consider the colour independent of its brightness/intensity/luminance? Then we can normalise the $X, Y, Z$ by scaling by their sum:
\[x = \frac{X}{X+Y+Z} \qquad y = \frac{Y}{X+Y+Z} \qquad z = \frac{Z}{X+Y+Z}.\]Having lost a degree of freedom (the intensity), $x$ and $y$ now uniquely define the brightness-indepedent component of colour and is called the chromaticity. 
The sRGB colour space specifies the chromaticities of the red/green/blue primaries (and also the white point), which uniquely define a linear transformation between XYZ and sRGB.
\[\left(\begin{array}{c} R \\ G \\ B \end{array}\right) = \left(\begin{array}{rrr} 3.2410 & -1.5374 & -0.4986 \\ -0.9692 & 1.8760 & 0.0416 \\ 0.0556 & -0.2040 & 1.0570 \end{array}\right) \cdot \left(\begin{array}{c} X \\ Y \\ Z \end{array}\right).\]To be clear, these RGB values are linear RGB (on a scale 0 to 1) and do not correspond to display values. To convert to the display scale, sRGB uses the following Opto-Electronic Transfer Function (OETF),
\[R\prime = \left\{\begin{array}{ll} 1.055 R^{1/2.4}-0.055 & R > 0.0031308 \\ 12.92R & \mathrm{otherwise} \end{array}\right.\]After applying the OETF, values can be multiplied by 255 and rounded to convert to the 8-bit display output.
Results
Coming soon!
