Reference · Stars: names, positions, distance and colour
blackBodyColourfunction
The colour of a black body at a temperature, as a #rrggbb string, for drawing a star. It is the colour a camera would show, not a measurement, and it uses an approximation of the
black-body locus (good to a few percent between 1,000 and 40,000 K).
Import it
import { blackBodyColour } from "@johnmorrisdotca/hoshi-stars";
Definition
function blackBodyColour(kelvin: number): string
Parameters
| Name | Type | Description |
|---|---|---|
kelvin | number | Temperature in kelvin. |
Returns
string
A colour like #a4bdff.
Examples
import { blackBodyColour } from "@johnmorrisdotca/hoshi-stars";
console.log(blackBodyColour(10000), blackBodyColour(3500));#cadaff #ffc18dWhat it prints (run when this page was built)