Skip to main content
A paper style sets how a drawing looks: line weights, colours, hatches and text. Floorkit has four built-in styles, and you can add your own. resolvePaperStyle changes a style id or a partial style into a full style.

Import

Example

Notes

  • The built-in styles are ISO_128, INK_SKETCH, GRAPHITE and NAPKIN.
  • Practice presets gives two example sets of styles and view settings, copied from two real sets of UK permit drawings.
  • Your style replaces a built-in style that has the same id.
  • An unknown id gives the default style, and the id appears in unresolved.
  • With no input, the function returns undefined.
  • annotationText: { background: 'paper', paddingMm } blanks a box behind each text annotation (a note) in the paper colour, in the SVG, the PDF and the sheet on screen, so the note reads over hatches and lines. The box is the text’s estimated box (0.6 of its height for each character, from its height above the baseline to a quarter of it below, turned with the note) grown by paddingMm (default 0.5 mm). background: 'none', the default, draws the note straight over what is under it. A bad value is listed in unresolved and ignored.
  • In a section or an elevation, the outline of a cut part has the edge class SectionCut, and the outline of a part seen beyond the cut has VisibleOutline. SectionCut uses the cut pen until a style sets it in edgeClasses, for example edgeClasses: { SectionCut: { weightMm: 0.35 } }.
  • A cut outline has its own edge class, so a style that sets VisibleOutline to thin lines does not make cut lines thin. ISO 7519 draws a cut outline heavier than a seen line.
  • A view title uses the font of the sheet’s style, typography.fontFamily, not the style of its viewport. To set the font of the titles, put typography in the styleOverride of the paper document or of the sheet.
  • viewTitle sets how each view title of the sheet is drawn, and in a viewport’s own styleOverride how the title of that viewport is, field by field: rule: false draws no rule under the title, position puts the title at 'below-left' (the default), 'below-right', 'above-left' or 'above-right' of the viewport frame, or centred on it at 'below-center' or 'above-center', textMm sets the height of the title in mm (1.8 to 20, the lettering heights of ISO 3098, default 5; the scale line is 0.7 of it), scaleTemplate words the scale line with {scale} for the scale, such as 'Scale {scale}' for Scale 1:100, and fontWeight: 'bold' sets the title bold. A title at the right is right-aligned with the frame. title.showScale: false on the viewport still removes the scale line. With no viewTitle, every title is the same as before.
  • fontWeight: 'bold' on a class entry, its byKind.text entry, a part or a phase class sets the text of that class in the bold face, for example classes: { SPACECONTAINER: { byKind: { text: { fontWeight: 'bold' } } } } for bold room labels. The SVG writes font-weight="bold". The PDF sets the bold face of its font: Paper Mono SemiBold for Paper Mono, the default face, which it embeds like Paper Mono Regular, and Helvetica Bold, Times Bold or Courier Bold for the standard faces.
  • classes.<type>.parts styles one named part of a symbol. The key is the primitive’s style.subId, for example classes: { ROOFLIGHT: { parts: { 'rooflight-opening': { dash: [3, 1.5] } } } }. A part entry has the fields of a class entry and is applied after byKind and before the edge class. visible: false in a part removes only the primitives of that part. With no parts, every drawing is the same as before.
  • The part names below are the subId values that the plan symbols give their primitives. On a roof plan a rooflight is drawn by its roof, so its parts are styled under classes.ROOF.parts. On a floor plan a rooflight is drawn by itself, so its parts are styled under classes.ROOFLIGHT.parts. A style for both plans sets the parts under both classes.
  • phases.<phase>.classes.<type> styles one element type in one phase. For example, phases: { new: { classes: { WALL: { fill: '#d9c4a0' } } } } fills the new walls and keeps the pens of new floors and rooms. The entry has the fields of a class entry, byKind and parts included, and is applied after the phases.<phase> entry. visible: false there removes that type in that phase only: phases: { demolished: { classes: { DOOR: { visible: false } } } } removes the demolished doors from a proposed plan and keeps the demolished walls. Only a view with phaseFilter: 'proposed' gives a phase to its lines. With no phase classes, every drawing is the same as before.
  • materials.<material> styles the cut of one material. The key is the material a cut region carries: a WallMaterial such as WOOD, or a key of BuildingModel.materials. An entry takes ink, weightMm, fill and hatch, and is applied after classes and edgeClasses and before phases, so a phase that sets a fill or a hatch still wins. For example, materials: { WOOD: { hatch: 'stud' }, INSULATION: { hatch: 'batt' } } draws timber studs as a zigzag and insulation as batt loops. A materials fill or hatch replaces the hatch the material draws by itself. With no materials, every drawing is the same as before.
  • roles.<role> styles one line role of a section or an elevation: cut, silhouette, projected, hidden, datum, marker, surface or ground. An entry has the fields of a class entry except byKind and edgeClasses, and is applied after the default role pen and before classes. For example, roles: { silhouette: { weightMm: 0.35 } } draws the outlines of seen parts heavier and keeps the lines inside them. The default role pens are 0.5 mm for cut and ground, 0.35 mm for marker, 0.25 mm for silhouette, 0.18 mm for projected and surface, and 0.13 mm for hidden and datum.
  • depthBands steps the silhouette and projected lines by their depth: the metres from the view plane to the nearest point of the face that the line belongs to. The first band whose untilM is at or beyond that depth adds its ladderStep. For example, depthBands: [{ untilM: 1.5, ladderStep: 1 }] draws the parts within 1.5 m of the view plane one pen heavier.
  • surfacePatternMinGapMm sets the least paper gap, in mm, between two parallel lines of a material pattern on a seen face (style.surfacePattern) at the scale of the viewport. Of each run of parallel courses the first is kept, then each next course at least that gap from the last kept one; the others are left out. For example, surfacePatternMinGapMm: 0.6 draws a plain-tile lean-to roof at 13° seen from its eave at 1:100, whose courses are 0.23 mm apart, with every third course. With no surfacePatternMinGapMm, every course is drawn.
  • edgeClasses.<class>.visible: false removes every line of that edge class. For example, edgeClasses: { VisibleCrease: { visible: false } } removes the lines where two faces of a seen part meet, such as the facets of a bay window base, and keeps the outlines. A phase entry with its own visible wins over the edge class, and the edge class wins over a class entry.
  • classes.<type>.edgeClasses.<class> styles one edge class of one element type. An entry has the fields of a class entry except byKind, parts and edgeClasses, and is applied after the style-wide edgeClasses entry. For example, classes: { WALL: { edgeClasses: { VisibleCrease: { visible: false } } } } removes the crease lines of the walls and keeps the creases of roofs, fascias and bays. Its visible wins over the style-wide edge class, so visible: true draws a crease that edgeClasses removes for every other type. A phase entry with its own visible still wins. An unknown edge class key changes nothing, as in edgeClasses. With no edgeClasses on a class, every drawing is the same as before.
  • With no roles, no depthBands and no edge class visible, every drawing is the same as before.
  • A literal hatch spec of an unknown kind, or a stud or batt spec with no positive pitchMm, is left out and reported in unresolved, as hatch kind '<kind>' or hatch '<kind>' needs a positive pitchMm.

Part names

A section mark draws its cut line in three pieces that meet and do not overlap at every scale: 10 mm on the paper at each head (cut-end) and the middle between them (cut). classes: { MARKER: { parts: { cut: { visible: false } } } } draws only the ends and the heads; parts: { cut: { dash: [3, 1.5] }, 'cut-end': { weightMm: 0.5 } } dashes the middle and draws the ends heavier. In a section or an elevation, each seen line and seen region of a door or a window carries the name of its physical part as its subId: window-frame, sash, mullion, transom, glazing-bar, window-sill and glazing for a window, door-frame, door-leaf, door-panel, rail and glazing for a door. Cut regions and cut lines, and the window of a dormer, carry no part name. A seen region (surface) takes no fill from a class or a phase, only from a part entry: phases: { new: { classes: { WINDOW: { parts: { glazing: { fill: '#cde6f7' } } } } } } fills the glass of the new windows and leaves the existing glass unfilled.

resolvePaperStyle

Flatten a style input against a registry.

mergeStyle

Merge one style over another, at the depth each field means: - classes / edgeClasses / roles / phases / materials: key by key, then field by field on the class, then field by field on each byKind, parts and edgeClasses entry, and on each phase’s classes the same way — so an overlay that says &#123; classes: &#123; WALL: &#123; ink &#125; &#125; &#125; keeps WALL’s weight, fill and hatch.

resolveSheetPolicy

The policy a sheet renders under: deps.paperStyle (caller) → the sheet → the document.

resolveViewportPolicy

The policy one viewport renders under.

documentStyleOf

A document’s style fields, for PaperRenderDeps.documentStyle.

PAPER_STYLES

The presets that ship, keyed by id.

DEFAULT_PAPER_STYLE_ID

ISO_128

INK_SKETCH

Freehand ink — a drafted plan in technical pen on vellum, in the register Francis Ching teaches: a compressed four-rung hierarchy, warm near-black ink that lightens as the line thins, solid poché pulled a hair in from its line, crossed corners with a short placed start and a longer lifted finish, a second strike on the heavy lines, and upper-case lettering with a little tracking.

GRAPHITE

Soft graphite on trace — a design-development plan in pencil on canary trace: every weight one rung heavier than ink (a pencil line is wider than a pen’s), warm greys that lighten as the line thins, a light warm poché with one sparse pass of scrubbed hatch over it (a tone, not a material), wider re-strike offsets than ink, longer softer tapers, a re-struck door swing, and larger upper-case lettering.

NAPKIN

Napkin sketch — the parti drawing: a fineliner on a paper napkin, drawn fast.

registerDrawingFont

Register a font for drawing text under its family, replacing one of the same family.

Types

PaperStyleInput

ResolvedPaperStyle

PaperStyle
required
Flattened: every extends walked and merged, no extends left.
string[]
required
Every reference that did not resolve, in the order it was met.

PaperRenderDeps

Dependencies the emitters (and, later, the screen renderer) need that aren’t part of the serializable document: the kernel-backed drawing extractor that resolves each viewport to vector data, and (optionally) the title-block template registry used to render a sheet’s title block.
(viewId: string, viewport?: import('../model/viewport').Viewport) => import('../model/raster-view').RasterDrawing | undefined
Resolve prepared named raster content; return undefined for a vector view.
DrawingExtractor
required
(viewId: string, viewport?: import('../model/viewport').Viewport) => VectorDrawing
Draw a named project view for viewport, the viewport that prints it (so a plan can place its tags for that scale); absent keeps bare paper renderers inline-only.
(viewId: string) => SavedDrawingView['kind'] | undefined
The kind of a named project view: plan, roof-plan, block-plan, section, elevation or iso. The sheet editor reads it to place a north arrow on a plan view only. Absent, a viewport with a viewId accepts a north arrow whatever its view.
TitleblockTemplateRegistry
UnitSystem
Which conventions to format numbers with.
number
Degrees from project north to true north, clockwise: the site’s trueNorthDeg. A north arrow turns by this plus its viewport’s rotation. Absent means 0.
ResolveSchedule
The rows a schedule annotation shows now, read from the model.
string
Fills the title block’s projectName auto-field, which nothing populated.
string
ISO date (YYYY-MM-DD) for the title block’s date auto-field. Absent means today, which makes a rendered sheet non-reproducible — a batch export or a golden test pins it here.
DimensionStyleRegistry
Mirrors PaperDocument.dimensionStyles; set from it by the exporter and the renderer, for the same reason unitSystem is.
PaperStyleInput
A caller’s paper style — an id or an inline overlay — for this render only. Narrower than anything stored: it outranks the viewport’s, the sheet’s and the document’s own style.
PaperStyleRegistry
Extra presets a host registers, resolvable by id alongside the builtins. A document’s own paperStyles outrank these.
DocumentStyleFields

DocumentStyleFields

The style-bearing fields of a document, lifted into the render deps.

BuiltinPaperStyleId

The presets that ship.
Last modified on November 30, 2026