Package Exports
- @loworbitstudio/visor-theme-engine
- @loworbitstudio/visor-theme-engine/adapters
- @loworbitstudio/visor-theme-engine/fowt
- @loworbitstudio/visor-theme-engine/schema
Readme
@loworbitstudio/visor-theme-engine
Theme engine for the Visor design system — shade generation, token mapping, font resolution, and import/export for .visor.yaml themes.
Installation
npm install @loworbitstudio/visor-theme-engineWhat It Does
- Generates dark and light color scales from a brand anchor color using OKLCH
- Maps theme configuration (
.visor.yaml) to CSS custom properties - Resolves font declarations against the Visor fonts CDN
- Exports theme bundles for use in any project
- Provides a
docsAdapterfor registering themes in fumadocs sites
Usage
Themes are typically managed via the Visor CLI (visor theme sync). Direct API usage is for advanced cases — building custom theme tooling or integrating with non-CLI workflows.
import { generateTheme } from '@loworbitstudio/visor-theme-engine'Migration
Themes pinned to ^0.4.x with a custom mono font
Engine 0.5 expanded typography.mono to accept weight | weights | source | org (previously only family). Engine 0.6 added validate-coverage, which errors when any --font-* declaration names a family with no matching @font-face. The combination created a trap: themes pinned to ^0.4.x could only write mono: { family: X } (the only thing 0.4 allowed) and could not express the source/org fix the 0.6 error message points to.
To migrate:
Bump both
@loworbitstudio/visor(the CLI) to≥ 0.10and@loworbitstudio/visor-theme-engineto≥ 0.6together. The CLI transitively pins its own engine copy (CLI 0.10 → engine^0.6.0), sovisor theme syncruns against the CLI-bundled engine, not the hoisted one — bumping the engine alone is silently insufficient.Decide between inheritance and explicit declaration:
Inheritance (preferred when applicable). If your mono slot's family matches another slot (heading, display, or body) with
source/orgset, leavetypography.mono.sourceandtypography.mono.orgunset. The engine will inheritsource/orgfrom the matching slot. Match precedence: heading → display → body, case-insensitive.typography: body: family: PP Model Mono weight: 400 source: visor-fonts org: low-orbit-studio mono: family: PP Model Mono weight: 400 # source/org inherited from bodyExplicit declaration. Otherwise, add
source(andorgforvisor-fonts) directly:typography: mono: family: PP Model Mono weight: 400 source: visor-fonts # or google-fonts, fontshare, local org: low-orbit-studio # required for visor-fonts only
System mono fonts (SF Mono, JetBrains Mono, Source Code Pro, Menlo, etc.) are already on the validator's SYSTEM_FONTS list and never need source/org.
Documentation
Full docs at visor.loworbit.studio.