Reference
Names on the brightest stars and the constellation figures as faint lines, for a sky you draw yourself: a count or a magnitude, the figure under the pointer at full strength, a body that covers part of the sky, and a look set by settings alone
import { … } from "@johnmorrisdotca/hoshi-stars/sky-labels";
134.8 kB minified and gzipped, with everything it imports (measured with esbuild)
Exports
| Name | Kind | What it is |
|---|---|---|
Box | type | A rectangle in the page's pixels, for the boxes a figure's name must stay clear of (StarNames.labels are such boxes). |
clampStrength | function | A strength held to 0 up to 1. |
CONSTELLATION_LINES_ATTRIBUTE | constant | The attribute a page offers for the lines, as a settings panel sets it: constellation-lines, a strength from 0 to 1. |
CoverMask | type | How a page says that a spot of its screen is covered by a body in front of the sky (the Earth, a planet, a panel): true where a star would not be seen. |
createFigureLines | function | The constellation figures as lines for a sky of your own, faint, with the figure under the pointer at full strength and its name. |
createStarNames | function | The names of the brightest stars for a sky of your own. |
Culture | type | A sky culture: a named set of figures. |
DEFAULT_LABEL_STYLE | constant | The look a name has when nothing is asked for, chosen from several proposals, "Display with catalogue letters": the name in Michroma in small capitals with wide letter spacing, a thin ring round the star, and the star's catalogue letter under it in small monospace. |
DEFAULT_LINE_STRENGTH | constant | The strength the lines have when a page asks for them and says no more: faint, so that most of the sky is seen without lines. |
designationWidth | function | The width a star's catalogue letter (α Ori) takes in pixels in the look's small monospace, 0.6 of its size a letter; 0 where it is not drawn. |
discCover | function | A mask for a round body, such as the Earth seen from space: every spot within radius pixels of its centre is covered. |
FigureLines | type | The figures of one sky. |
FigureLinesSettings | type | What the lines are. |
FigureName | type | The name of the picked figure and where to draw it, centred on x, with its baseline at y: clear above the figure, and never over a star's name. |
FigureOnScreen | type | One figure on the screen: where its lines are in FigureLines.segments, and its name's spot. |
LABEL_SIDES | constant | The places a name may take, in the order they are tried: right of its star, left, above, below. |
LABEL_STYLE_PROPERTIES | constant | The name of the CSS custom property for each part of the look, for a page that styles its labels from a stylesheet. |
labelHeight | function | The height a line of text takes in pixels: 1.2 times its size. |
LabelSide | type | A place for a name. |
labelStyle | function | A complete look from a partial one: every part left out or not usable takes its default, and every number is held to its range, so a bad setting never breaks a label. |
LabelStyle | type | The look of a name drawn on the sky. |
labelStyleFrom | function | A look read back from CSS custom properties: any property the page has not set keeps its default. |
labelStyleVars | function | A look as CSS custom properties, to set on the element that holds the labels (element.style.setProperty(name, value)), so a stylesheet can restyle them as well. |
labelText | function | A name with the look's case applied. |
labelWidth | function | The width a name takes in pixels, from its length and the look: a Latin letter is about 0.6 of the size wide (0.75 in small capitals, which are wide in Michroma), a Japanese letter the whole size, and the letter spacing is added after each letter. |
lineStrengthFromAttribute | function | The strength from the attribute constellation-lines, read as text. |
NameLanguage | type | The language of the names: en for the IAU spelling (Sirius), ja for the katakana (シリウス, English where a star has no katakana). |
placeLabel | function | Put a name on one side of a star: right, left, above (centred over it) or below (centred under it), with the star's catalogue letter under the name when designation is true. |
ScreenPoint | type | A place on the page's screen, in pixels from its top left corner. |
SkyProjector | type | How a page says where a star is: it gets the star's right ascension and declination in degrees and writes the spot on its screen into out. |
SkyView | type | The part of the screen names may use, in pixels. |
STAR_NAMES_ATTRIBUTES | constant | The attributes a page offers for the names, as a settings panel sets them: star-names (a count) and star-names-magnitude (a limit). |
StarNameLabel | type | One name to draw: the star, the text with the look's case applied, and where everything goes, in the page's pixels. |
StarNames | type | The stars' names for one sky. |
starNamesFromAttributes | function | Settings from the two attributes a page offers, star-names (a count) and star-names-magnitude (a limit), read as text. |
StarNamesSettings | type | What to name. |