LabelStyletype
The look of a name drawn on the sky. Every part is a plain value, so a page can keep one in its settings, in its address or in CSS custom properties (labelStyleVars, labelStyleFrom).
Import it
import type { LabelStyle } from "@johnmorrisdotca/hoshi-stars/sky-labels";
Definition
interface LabelStyle {
font: string;
size: number;
weight: number;
colour: string;
halo: string;
haloWidth: number;
case: "small-caps" | "as-written" | "upper" | "lower";
letterSpacing: number;
leader: number;
leaderColour: string;
offset: number;
ring: number;
ringColour: string;
ringWidth: number;
designation: "below" | "none";
designationFont: string;
designationSize: number;
designationColour: string;
}
Members
| Name | Type | Description |
|---|---|---|
font | string | The font family, as CSS writes it. |
size | number | The text size in pixels, 6 to 48. 11 by default. |
weight | number | The font weight, 100 to 900. 400 by default. |
colour | string | The text colour, any CSS colour. A quiet white by default. |
halo | string | The colour of the outline round the letters that keeps them readable over stars, any CSS colour, or |
haloWidth | number | The width of that outline in pixels, 0 to 12. 3 by default. |
case | "lower" | "upper" | "small-caps" | "as-written" |
|
letterSpacing | number | The space added between letters, in em, -0.1 to 1. 0.14 by default. |
leader | number | The length in pixels of a short line from the star to its name, 0 to 80, or 0 for no line and the name set beside the star. 0 by default. |
leaderColour | string | The colour of that line, any CSS colour. A quiet blue-white by default. |
offset | number | The gap in pixels between the ring round a star (or the star) and its name (or its line), 0 to 40. 4 by default. |
ring | number | The radius in pixels of a thin ring drawn round each named star, 0 to 30, or 0 for no ring. 6 by default. |
ringColour | string | The colour of the ring, any CSS colour. A quiet blue-white by default. |
ringWidth | number | The line width of the ring in pixels, 0.25 to 4. 0.75 by default. |
designation | "none" | "below" |
|
designationFont | string | The font family of that line. A small monospace by default. |
designationSize | number | Its size in pixels, 6 to 24. 9 by default. |
designationColour | string | Its colour, any CSS colour. A quieter white by default. |
Examples
import { labelStyle, type LabelStyle } from "@johnmorrisdotca/hoshi-stars/sky-labels";
const style: LabelStyle = labelStyle({ case: "upper", letterSpacing: 0.12 });
console.log(style.size, style.case);11 upperWhat it prints (run when this page was built)