Digital color codes of stars

Publications in astrophysics are nowadays mainly published and read in digitized formats. Astrophysical publications in both research and in popular outreach often use colorful representations of stars to indicate various stellar types, that is, different spectral types or effective temperatures. Computer generated and computer displayed imagery has become an integral part of stellar astrophysics communication. There is, however, no astrophysically motivated standard color palette for illustrative representations of stars and some stars are actually represented in misleading colors. We use pre-computed PHOENIX and TLUSTY stellar model spectra and convolve them with the three standard color matching functions for human color perception between 360$\,$nm and 830$\,$nm. The color matching functions represent the three sets of receptors in the eye that respond to red, green, and blue light. For a grid of main sequence stars with effective temperatures between 2300$\,$K and 55,000$\,$K of different metallicities we present the red-blue-green and hexadecimal color codes that can be used for digitized color representations of stars as if seen from space. We find significant deviations between the color codes of stars computed from stellar spectra and from a black body radiator of the same effective temperature. We illustrate the main sequence in the color wheel and demonstrate that there are no yellow, green, cyan, or purple stars. Red dwarf stars (spectral types M0V - M9V) actually look orange to the human eye. Old white dwarfs such as WD$\,$1856$+$534, host to a newly discovered transiting giant planet candidate, occur pale orange to the human eye, not white. Our freely available software can be used to generate color codes for any input spectrum such as those from planets, galaxies, quasars etc.


INTRODUCTION
Digitized representations of stars have become an integral part of publications in astronomy and astrophysics. Though realistic colors of stars are sometimes irrelevant for depictions of an astrophysical process, they can be helpful to support the message of a figure in a paper (Becker, Vanderburg, Adams, Khain, & Bryan, 2017;Heller & Pudritz, 2016;Hippke & Angerhausen, 2015;Kaltenegger et al., 2010;Kasting & Harman, 2013;Sidis & Sari, 2010) or a slide in an electronic science talk 1 . And in some cases, though the effect may be subtle, color is key, for example for the Rossiter-McLaughlin effect (Bourrier et al., 2018;Sanchis-Ojeda et al., 2012) or for the color-induced displacement of binary stars (Pourbaix, Ivezić, Knapp, Gunn, & Lupton, 2004). In fact, the history of modern astronomy is deeply rooted in by-eye analyses of the apparent colors of stars and their relation to the temperature (Hertzsprung, 1911;Payne, 1925;Russell, 1914).
Beyond the scientific value of colorful stellar representations, the colors of stars play an important role in digitized science dissemination activities to the public, such as press releases 2 , educational websites 3 , electronic books 4 (Fraknoi, Morrison, & Wolff, 2019), electronic slides in public talks etc.
That said, no uniform scale for the digitized color codes of stars exists. The digital illustration of stellar colors is often done in a pragmatic fashion rather than in a scientifically founded way and color representations of essentially the same types of stars differ greatly among publications in the various outlets listed above. Moreover, some myths about the red color of so-called red dwarf stars, of a brownish look of brown dwarfs, and of the white appeal of white dwarfs prevail. Here we develop a reproducible method to compute the colors of stars as they appear to the human eye (from space) and we report the digital color codes of main sequence stars.

Stellar model spectra
As input spectra to our color calculations, we used precomputed model stellar spectra of the flux densities as a function of wavelength. For effective temperatures 2300 K ≤ ef f ≤ 12, 000 K we used spectra from the publicly available 5 PHOENIX spectral library of Husser et al. (2013). Additional PHOENIX spectra with ef f up to 15,000 K were provided by courtesy of T. O. Husser in private communication. The PHOENIX model grid embraced surface gravity values 0 ≤ log( ) ≤ 6 ( expressed in units of cm s −2 ) and stellar metallicities [Fe∕H] ∈ {0, −1, −2}. All spectra were provided on the same wavelength grid (500 Å ≤ ≤ 5.5 m) and with a typical resolution of = ∕Δ = 500, 000 in the optical regime.
These spectra were computed using version 16 of the PHOENIX software (Hauschildt & Baron, 1999). Spherical symmetry of the stars was assumed and each atmosphere was represented by 64 layers. The assumption of local thermal equilibrium (LTE) was justified by the maximum effective temperatures of 12,000 K, and dust settling was ignored because it is insignificant for ef f ≥ 2300 K. For details we refer the reader to Husser et al. (2013).
For OB stars with 16, 000 K ≤ ef f ≤ 55, 000 K we used TLUSTY models 6 of the BSTAR2006 grid of Lanz & Hubeny (2007) and the OSTAR2002 grid of Lanz & Hubeny (2003). These models take into account the effects of non-LTE in plane-parallel, hydrostatic atmospheric layers. Due to the very weak absorption lines of these hot stars, the differences in the color codes are very small across different stellar metallicities. As a consequence, we restricted our analysis to solar metallicity.

Color codes and Matching functions
To infer the digital color codes for the model spectra as if they were perceived by the human eye, we used color_system.py 7 . This python module uses data from color matching functions (CMFs), which describe the perception of light by the cone cells in the human eye under standardized illumination, to convert a spectrum to a color code. Since the model stellar spectra have a high wavelength resolution we used the latest values of the 2-degree XYZ CMFs 8 , transformed from the 2006 CIE (International Commission on Illumination) 2-degree LMS (long-medium-short color space) cone fundamentals (Stockman & Sharpe, 2008), which come with one data point per Å. We then degraded the resolution of the synthetic stellar spectra to the same wavelength resolution.
In Fig. 1 we show the CMFs (blue, green, red lines) together with two example spectra, one being a black body of 2500 K (black line) and one being a PHOENIX spectrum for ef f = 2500 K, log( ) = 5, and [Fe∕H] = 0. Both spectra are normalized to a value of one (see inset). The presence of strong molecular absorption bands in the PHOENIX spectrum suggests that the resulting color perception, and therefore also the digital color codes, differ substantially between a black body and a stellar spectrum of the same effective temperature.

Spectral typing
The PHOENIX spectra are not formally linked to a given stellar spectral type (SpT), although empirical relationships can be used to relate PHOENIX spectra with SpT. To simplify the choice of an appropriate color representation for a given SpT, one of our aims was to create a look-up table that is astrophysically motivated but particularly suitable from an astronomer's perspective.
To this end, we matched spectral types of main-sequence stars with the corresponding ef f and log( ) values from our grid of PHOENIX models -and for consistency also for the TLUSTY models. First, we used Table 5 of Pecaut & Mamajek (2013) to match ef f from the synthetic models with observed spectral types of stars. These authors used a weighting scheme of a large sample of standard main-sequence stars from the literature to infer a ef f -SpT relation for ef f ≤ 34, 000 K. Stellar surface gravities were not provided. As an alternative, we define three intervals of log( ) based on the ef f -log( ) relation For ef f > 34, 000 K we used Table 7 of Eker et al. (2018) for the SpT-toef f matching.

Limb darkening
For illustration purpose only, we generate a library of plots of the apparent stellar surface that include limb darkening as parameterized by the quadratic limb darkening law, where = cos( ), is the angle between the line of sight and the normal to the stellar surface, is the specific intensity, and ( , ) are the limb darkening coefficients. This model does not take into account the possible wavelength dependence of limb darkening, that is, chromatic effects. We used limb darkening coefficients that reproduce the limb darkening as observed in the filter of the Gaia mission ( Table 2 in Claret, 2019). We chose the Gaia filter because its response curve matches reasonably well with the response function of the human eye (Weiler, 2018). Given that the PHOENIX and TLUSTY model grids and the limb darkening tables have different step sizes in the model parameters, we used linear interpolation of the limb darkening coefficients whenever necessary to represent stars on the model grid.
In technical terms, limb darkening was implemented into our computer code by first creating a two-dimensional array with 1001 × 1001 entries, each containing a sub-array with the respective RGB color triple values of the star. Each RGB triple entry corresponded to a radial distance from the stellar center. Using the relation = √ 1 − 2 (Heller, 2019), with 0 ≤ ≤ 1 being the radial distance from the star disk in units of stellar radii, each entry in the color array was multiplied with the corresponding intensity of the limb darkening in Eq. (2) law to obtain the radial limb darkening profile.

Digital color codes
In Table 1 we list the RGB and Hexadecimal (Hex) color codes of black bodies with 2300 ≤ ≤ 12, 000 K, the temperature range of which corresponds to the publicly available PHOENIX models. Columns 2 and 3 refer to the colors of a black body in vacuum without any extinction or transmission through an additional medium between the radiator and the observer. In Tables 2 -4 we show the RGB and Hex color codes as computed from the PHOENIX spectra for 2300 ≤ ef f ≤ 12, 000 K. The color variation of stars with ef f > 12, 000 K is hardly notable to the human eye, which is why we restricted Tables 2 -4 to ef f ≤ 12, 000 K. Table 2 , for [Fe∕H] = 0, contains color codes for 841 PHOENIX spectra; Table 3 and its 846 entries refer to [Fe∕H] = −1; and Table 4 is a list of 848 PHOENIX spectra assuming [Fe∕H] = −2. Table 5 is a look-up table for the color codes of main-sequence stars of a given spectral type and embraces both the PHOENIX and the TLUSTY models with effective temperatures up to 55,000 K. Figure 2 is a visual representation of these color codes. Panel (a) shows the stellar main sequence in the color wheel. Color codes were first computed using the PHOENIX and TLUSTY spectra and then a selection of spectral types were marked in the color wheel in steps of about half a spectral class between M9.5 to O1 (all of luminosity class V). To our knowledge, this is the first digital color code representation of the long known astronomical observation that there are no yellow, green, cyan, or purple stars. At the lowest temperatures, the main sequence begins with orange stars of SpT M9.5, then continues to produce brighter and brighter stars across the K class until it reaches the white point with stars of SpT F9.5. Sun-like stars with SpT G2 are slightly yellowish. Early-type stars of spectral classes A, B, and O tend to have ever more blue colors. Interestingly, for spectral types earlier than about B5 the colors of increasingly hotter stars converge towards a blueish tone of RGB = (90,123,255). In Figure 2 (b) we illustrate the differences between the colors of main-sequence stars as depicted in panel (a) and black bodies of the same effective temperatures for the same selection of spectral types. Pairs of model spectra (filled circles and crosses) and black bodies (open circles) of the same ef f are connected with a black line. Interestingly, while there are significant deviations between the two models for both the most late-type stars and the most early-type stars, colors virtually agree for SpT K0. We also note two inflection points in the color differences, one between M4.5 and M0 and a second one between K5 and K0.

Limb darkening
The effect of limb darkening is illustrated in Fig. 3 for a sunlike star. The left panel has no limb darkening, the right panel includes the quadratic limb darkening law. Our implementation of limb darkening comes after the calculation of the RGB codes from the model spectra, which means that the RGB colors codes given in Tables 2 -4 refer to the center of the stellar disk.
For each of the 107 stars listed in the look-up Table 5 , we generated an illustration in portable document format (PDF, version 1.4) using the python plotting package matplotlib that is similar to the one in the right panel of Fig. 3 . These electronic images are available in the online version of this report.

Black bodies and stellar spectra
The color differences between black bodies and stellar spectra mentioned above are illustrated in more detail in Fig. 4 . The left column shows stellar disks with limb darkening and colors based on the black-body approximation, and the right column refers to PHOENIX spectra as if observed from space.
In the upper row, which features a 2700 K star (corresponding to SpT M6.5), the black body disk appears redder than the PHOENIX star. We suppose that this reddish color derived from the black-body approximation could, at least partly, explain why the most early-type stars are called 'red dwarfs'. The 5200 K black body radiator (left) in the center row shows almost no visible color difference to the PHOENIX star (SpT K1V, central panel). For ef f = 8000 K in the bottom row the black body disk looks lighter due to its slightly increased red values compared to the PHOENIX model disk.
The menagerie of model main-sequence stars in Fig. 5 shows a summary of our astrophysical model. Colors are based on the PHOENIX models as if seen from space, the stellar disk is modeled using quadratic limb darkening, and stellar radii are scaled according to Eker et al. (2018) for main-sequence stars of the respective spectral types.

DISCUSSION
Our color codes carry information about the chromaticity (hue and saturation) of stars but not about their brightness (see Fig. 5 ). If we were to include stellar brightness as well, we would need to invoke the stellar luminosity and distance from Earth to compute an apparent brightness. The stellar luminosity could, in principle, be obtained from stellar evolution models or mass-luminosity scaling relations for stars of a given mass. The model spectra, however, do not make any assumptions of the stellar mass and so we would also have to assume 2700 K BB 2700 K PHX Space 5200 K BB 5200 K PHX Space 8000 K BB 8000 K PHX Space  Table 2 . Quadratic limb darkening is modeled on top of the stellar disk. Perception of the colors (and their differences) depends on the monitor or print as well as on the individual vision abilities of the viewer. a given age or evolutionary phase to match the resulting effective temperature and log( ) between stellar evolution models and the synthetic spectra.
Our illustrations of the stellar disks with limb darkening consider an achromatic radial intensity profile. Chromatic effects have been observed in the sun, for example by Neckel & Labs (1987). Strictly speaking, due to the wavelength dependence of stellar limb darkening, we should also expect a chromatic variation along the apparent distance from the stellar disk center. That said, the color codes that we calculate are derived from the model spectra directly and independent from our graphical illustrations.
The CMFs that we used came with a resolution of 1 Å thereby defining a limit to the accuracy of our calculations.

FIGURE 5
Selection of main-sequence stars with proper limb darkening, radii to scale and colors as computed in this report. All stars are of luminosity class V. From a human-perception point of view the plausibility of such an illustration is limited because the hottest stars (spectral type O) can be millions or billions times more luminous than the coolest stars of (spectral type M). We do not take into account the effect of brightness.
We tested the effect of the resolution of the CMFs by decreasing their resolution artificially by a factor of two. We found that the black-body RGB color codes of some stars changed on the permille level, certainly below the level of perception for the human eye. For the PHOENIX spectra the situation was more complex. For ef f > 3000 K changes in the RGB color codes were < 1 %, and therefore unlikely to be visible to most people. For even lower temperatures and down to the coolest M dwarfs with ef f = 2300 K, variations between our nominal results and the degraded resolution were always below 1 % for main-sequence stars. Only for the coolest stars with extremely low surface gravities of log( ) = 0, variations in the G color channel were more significant, up to 2.5 % for 2600 K ≤ ef f ≤ 3000 K and up to 8 % for 2300 K ≤ ef f ≤ 2600 K. The R and B channels varied on a percent level for these cool and low-giants. In brief, the resolution of the CMFs is sufficient for the main-sequence stars to produce digital color codes exact to one permille for ef f > 3000 K and exact to one percent for ef f < 3000 K. We also examined the impact of stellar rotation on the apparent colors. Stellar rotation leads to rotational broadening of the spectral absorption lines, which may or may not have a visible effect. We tested this by applying rotational broadening to a synthetic ATLAS spectrum (Kurucz, 1993;Sbordone, Bonifacio, Castelli, & Kurucz, 2004) with ef f = 50, 000 K and log( ) = 5.0 with a corresponding linear limb darkening coefficient of = 0.1680 (Claret, 2019). We assumed a rotational velocity of sin( ) = 200 km∕s to maximize the effect of a rapidly rotating early-type star (Abt, Levato, & Grosso, 2002).
After applying the rotational broadening using the freely available rotBroad() 9 python function from the PyAstronomy module and extracting the color codes from the spectrum, we found that the Hex color code remains unaffected and the RGB color code was only affected at the 7th decimal place. In summary, stellar rotation does not have a visible effect on the perceived colors of stars.
CMFs are usually derived from a series of experiments with test persons. Different test series derive different CMFs, although results are very similar (North & Fairchild, 1993). Thus we expect that choosing a different set of CMFs would result in virtually the same digital color codes of mainsequence stars. Irrespective of the color codes that we provide, the perception of the colors and of the apparent color differences depends heavily on the monitor or printer used to display the star images. The color vision abilities of the viewer also affect the hue, that is to say, the color appearance of any light source.
Another potentially relevant effect on color perception is the Purkinje effect (Graff, 2013), which makes reds appear darker and blues brighter at low brightness. Our color codes are determined as if the stars were observed under standard illumination, which is a somewhat artificial experimental setup for a hypothetical by-eye observation from space, admittedly. In a real space-based observation of a star with the unaided human eye, the Purkinje effect could lead to a slight difference in the perceived colors compared to our color codes.
In this paper, we restrict ourselves to the apparent colors of stars as if seen from space. For an observer on Earth, the colors would look slightly different due to several effects in the Earth's atmosphere such as scattering of the light in the atmosphere, scintillation, Rayleigh scattering, and the presence of carbon black dust and other small particles (Schlosser, Schmidt-Kaler, & Milone, 1991, Chapter 19). That said, we did a small experiment of simulating the transmission of stellar light through the Earth's atmosphere using data from the HITRAN 10 database (Gordon et al., 2017). Every molecule and isotopologue listed in the database, except for the CO 2 isotopologues 18 C 13 C 17 O and 13 C 17 O 2 , was used in the generation of the absorption spectrum. The resulting transmission spectrum was binned to the same wavelength grid as the CMFs with a fixed wavelength step size of 1 Å. The transmission spectrum was normalized to a maximum value of one and then multiplied with the respective PHOENIX spectrum. The transmission spectrum for the Earth's atmosphere was normalized to the maximum value in the wavelength range of the model spectra. A different normalization would result in similar colors, since the absorption of light in the Earth's atmosphere only has a small impact (∼ 0.1%) on the RGB color code. As a result, we found that the effects from transmission on the stellar RGB color codes are less than about 1 %. The other atmospheric effects are probably more significant.
The digital color codes that we computed for black bodies can safely be used as representative for white dwarfs of spectral type DC. Spectra of DC white dwarfs are very close to black body radiators with essentially no significant absorption lines (Greenstein, 1958;Wegner & Yackovich, 1983). This has some remarkable implications for DC white dwarfs with cooling ages of billions of years, at which point their effective temperatures drop below 5000 K. The look of these white dwarfs is a light orange. Their color is similar to the star of SpT K2 in Fig. 5 . The stellar remnant of the recently discovered transiting exoplanet candidate WD 1856+534 b is a topical example (Vanderburg et al., 2020). With ef f = 4710 ± 60 K this DC white dwarf would really have a pale orange look to the human eye.

CONCLUSIONS
We use standard color matching functions representing the color perception of the human eye to determine the colors of stars from synthetic spectra. We find that colors derived from realistic stellar spectra differ substantially from colors based on a black body approximation. 10 https://hitran.org In particular, the coolest ( ef f = 2300 K) and thus most latetype (SpT M9.5V) main-sequence stars look orange to the human eye. The digital RGB color code of a solar metallicity M9.5V dwarf reads (1.0, 0.491, 0.144) ( Table 5 ). We suppose that part of the explanation for why these stars are often called red dwarfs is in the fact that a black body spectrum yields a much redder color, namely RGB = (1.0, 0.409, 0.078) ( Table 1 ). The colors of stars of SpT K1V -K0V (with ef f = 5200 K or 5300 K, respectively) are very similar to those of a black body with the same effective temperature. Early-type stars of SpT F, A, B, and O look bluer than their black-body counterparts because synthetic spectra yield lower red values in the resulting RGB color codes.
We find that the transmission of star light through the Earth's atmosphere has a negligible effect on color perception, with color differences on the level of a few permille in the corresponding RGB color codes.
Our ad-hoc parameterization of stellar limb darkening with the quadratic limb darkening law yields realistic, plastic illustrations of main-sequence stars with correct colors, achromatic limb darkening, and physical stellar radii to scale. To our knowledge, this is the first digital representation of mainsequence stars with consistent and correct colors based on astrophysical modeling. Our computer code, Spec2Col.py, is freely available and can be used to compute digital colors codes for any type of input spectrum. Images of 107 stars with spectral types ranging from M9.5V to O1V as per Table 5 including limb darkening are available as PDF with the online version of this paper.