Reference · A star drawn from its numbers as SVG, and next to the Sun
starPortraitfunction
A star drawn from its numbers as SVG text: a disc in the colour of its temperature, darker toward the edge by its limb-darkening coefficient, with a generic surface texture of the right kind of cells for its type, and, for Altair and Regulus, the flattened and gravity-darkened shape that interferometers measured, and for Vega the round face of a star seen over its pole. The picture says, in its own words, that it is drawn from numbers and that the texture is generic. Nothing in it is a photograph or an artist's guess at one star's markings.
Import it
import { starPortrait } from "@johnmorrisdotca/hoshi-stars/portrait";
Definition
function starPortrait(profile: StarProfile, options?: PortraitOptions): string | undefined
Parameters
| Name | Type | Description |
|---|---|---|
profile | StarProfile | A star's profile from |
options (optional) | PortraitOptions | Size, language, name, background and captions. |
Returns
string | undefined
An SVG document as a string, or undefined where the profile has no temperature to draw.
Examples
import { starByName } from "@johnmorrisdotca/hoshi-stars";
import { starProfile } from "@johnmorrisdotca/hoshi-stars/profile";
import { starPortrait } from "@johnmorrisdotca/hoshi-stars/portrait";
const svg = starPortrait(starProfile(starByName("Betelgeuse")!), { name: "Betelgeuse", size: 320 });
console.log(svg?.slice(0, 40));<svg xmlns="http://www.w3.org/2000/svg"What it prints (run when this page was built)