StarVision Theme Extraction
StarVision Extraction Loop
This loop is triggered when a user wants to create a new StarSpec wireframe theme from screenshots, PDFs, or textual guidelines.
1. Metadata Ingestion
The extraction process starts by gathering all available information. The theme.toml manifest is the Hard Constraint.
- Screenshots: Analyze
.pngor.jpgfiles for visual patterns. - Theme Manifest: Read
theme.toml(if present). - Style Guides: Read any provided
.pdfor textual descriptions.
Theme Manifest Priority
Values in theme.toml MUST be respected over visual analysis.
- If
theme.tomldefinesbrand.primary = "#FF0000", use that even if the screenshot looks blue. - Partial manifests are common; only the defined fields are mandatory.
2. Visual Analysis Pillar
Perform the three-pillar analysis defined in the StarVision Spec:
- Chromatic: Extract primary, background, and semantic HEX codes.
- Geometry: Identify border radii, stroke weights, and spacing densities.
- Elevation: Identify shadow styles and depths.
3. Proposal Phase
Before writing the CSS, present a Theme Proposal to the user for confirmation.
| Attribute | Extracted Value | Source |
|---|---|---|
| Primary Color | #HEX | theme.toml / Screenshot |
| Background | #HEX | Screenshot |
| Radius | 8px | Screenshot |
| Spacing | Compact | Screenshot |
4. Generation Phase
Once confirmed, perform the following actions:
- Write CSS: Create
src/styles/wireframe-{name}.css.- Use the compound selector pattern — two blocks, one for light (default) and one for dark. See
get_instructions("starspec/fragments/wireframe/theme-selector-pattern")for the exact template. - Implement all variables from
get_instructions("starspec/fragments/wireframe/theme-variables"). - Load custom fonts via
@importabove the variable blocks if[font]keys are present intheme.toml.
- Use the compound selector pattern — two blocks, one for light (default) and one for dark. See
- Register Theme: Add the new theme entry to
src/themes.json:{ "id": "{name}", "label": "{Label}" }astro.config.tsauto-discovers the CSS file viafs.existsSync()— no manual config change is needed.
5. Verification Phase
- Run
pnpm compileto ensure the registry and compiler are in sync. - Run
pnpm build(or check for errors in dev) to ensure the new CSS is valid. - Confirm the new theme appears in the
Headerdropdown.