labelStyleFromfunction
A look read back from CSS custom properties: any property the page has not set keeps its default. Pass how the page reads one, for example (name) => getComputedStyle(element).getPropertyValue(name).
Import it
import { labelStyleFrom } from "@johnmorrisdotca/hoshi-stars/sky-labels";
Definition
function labelStyleFrom(read: (name: string) => string): LabelStyle
Parameters
| Name | Type | Description |
|---|---|---|
read | (name: string) => string | Gives the value of a custom property by name, or an empty text where it has none. |
Returns
LabelStyle
A complete look.
Examples
import { labelStyleFrom } from "@johnmorrisdotca/hoshi-stars/sky-labels";
const style = labelStyleFrom((name) => (name === "--hoshi-label-case" ? "upper" : ""));
console.log(style.case, style.size);upper 11What it prints (run when this page was built)