<p>Below is a model taken from Mitchel Charity's page, <a href="http://www.vendian.org/mncharity/dir3/starcolor/" rel="noreferrer">
What color are the stars?</a>
Other points, if required, may be obtained by interpolation.</p>
<p>There are plenty of caveats with this and you should carefully read <a href="http://www.vendian.org/mncharity/dir3/starcolor/details.html" rel="noreferrer">Star color - details</a></p>
<p>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.</p>
<pre><code>  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
</code></pre>

CC BY-SA 4.0
2022-04-14T05:37:02.837Z
2022-04-14T05:37:02.837Z
James K
<p>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?</p>

CC BY-SA 4.0
2022-04-14T11:55:47.727Z
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.
Carl Witthoft
<star><python><spectral-type>
Convert from spectral type to RGB color?
prideout
# Convert from spectral type to RGB color?

(Asked by: username_0 on 2022-04-14)

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?

**Tags:** star, python, spectral-type

> **Comments:**
> **username_1**: 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.  

---

## 1 answers

### Answer by username_2 on 2022-04-14. Score: 9 | Accepted answer

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


---

