1
$\begingroup$

I'm writing a night sky simulator and I want to render stars using the correct color. Is there a formula that converts a two-character code (as seen in the Yale Star Catalog) to a RGB value?

$\endgroup$
1
  • 2
    $\begingroup$ As the answer suggests, depends whether you want the actual spectral output curve or the spectral irradiance curve at the Earth's surface, or the typical retinal color response curve. $\endgroup$ Apr 14, 2022 at 11:55

1 Answer 1

9
$\begingroup$

Below is a model taken from Mitchel Charity's page, What color are the stars? Other points, if required, may be obtained by interpolation.

There are plenty of caveats with this and you should carefully read Star color - details

In particular, the choice of white-point makes a big difference, especially to F and G type colours. Moreover, while these show colour, they don't account for brightness. Most dim stars look white to our eyes because they don't give enough light to activate the colour sensitive cone cells. And if you were close enough to an O type star to see its surface you would be completely dazzled and blinded. Then there are atmospheric effects to consider, etc. etc.

  O5(V)       157 180 255   #9db4ff
  B1(V)       162 185 255   #a2b9ff
  B3(V)       167 188 255   #a7bcff
  B5(V)       170 191 255   #aabfff
  B8(V)       175 195 255   #afc3ff
  A1(V)       186 204 255   #baccff
  A3(V)       192 209 255   #c0d1ff
  A5(V)       202 216 255   #cad8ff
  F0(V)       228 232 255   #e4e8ff
  F2(V)       237 238 255   #edeeff
  F5(V)       251 248 255   #fbf8ff
  F8(V)       255 249 249   #fff9f9
  G2(V)       255 245 236   #fff5ec
  G5(V)       255 244 232   #fff4e8
  G8(V)       255 241 223   #fff1df
  K0(V)       255 235 209   #ffebd1
  K4(V)       255 215 174   #ffd7ae
  K7(V)       255 198 144   #ffc690
  M2(V)       255 190 127   #ffbe7f
  M4(V)       255 187 123   #ffbb7b
  M6(V)       255 187 123   #ffbb7b
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .