Skip to content
Shapemetry

@huukhanhnguyen/types / evaluate/styles

evaluate/styles

Style

Style = { background?: string; exposure?: number; name: string; shading?: "shaded" | "wireframe" | "realistic" | "matcap"; }

Resolved styles[] record — the RESOLVED shape evaluateStyles() / collectStyleNodes() produce from an authored style node's expression args, consumed BY NAME via a view's viewStyle step.

background?

optional background?: string

Viewport clear color, any CSS hex ("#1a1a1a").

exposure?

optional exposure?: number

EV compensation on the 3D viewport's auto-exposure meter, realistic mode only — same as a camera's +/- exposure dial: 1 (default) trusts the meter as-is, 2 doubles the metered brightness, 0.5 halves it.

name

name: string

shading?

optional shading?: "shaded" | "wireframe" | "realistic" | "matcap"

Viewport display mode — SSOT applied by Viewport.applyStyle on every host (edit/embed/model). "realistic" switches to PBR tone mapping and is the ONLY mode that materializes emitting light data and the document's settings.environment into real renderer lights. "matcap" is self-lit form-reading (MeshMatcapMaterial). "shaded" is the CAD headlight rig. Absent = host may fill via applyStyle({ defaultShading }) only; never overridden when authored.


StyleCapabilities

StyleCapabilities = { exposure: boolean; lights: boolean; materials: boolean; }

What a style's shading STYLE can show — the SSOT both the model's validation (which style fields a shading permits — exposure requires "realistic") and packages/three's Viewport read, instead of scattered shading === "realistic" string comparisons. NOT a "view kind" concept — an orthographic (drawing) view referencing a "realistic" style is legal (a lit axonometric in the viewport, Revit precedent); the 2D paper pipeline structurally never reads a style at all, so plans stay immune with no extra rule needed.

exposure

exposure: boolean

lights

lights: boolean

Emitting LightData objects and the document's settings.environment materialize into real renderer lights.

materials

materials: boolean

MeshData materials render (their own color/texture) vs. flat line work only.

Last updated: 📖 2 min readEdit on GitHub