isometric-diagrams
GitHubnpmCloud editor ↗

Assets

Every picture shows the asset in the light theme on the left and the dark theme on the right. They are made by node --experimental-strip-types scripts/asset-pics.ts, from the same code that draws diagrams.

An asset is drawn in its node's box (size: [w, d, h] in grid units; each asset has a default) and coloured by its role (role:; each asset has a default). A role gives a hue and saturation; the theme decides the lightness of each face in light and dark, so every asset shades the same way.

Node assets#

Use with asset: NAME on a node. Add decorations to any box-shaped asset with deco: (see below).

AssetPictureDefault size [w, d, h]Default roleWhat it is
blockblock2.4 × 2.4 × 1.6greyA box. Size and colour are free; the base for most things. The default asset.
sessionsession2.6 × 2.6 × 1.8workAn agent session: terminal lines on its front (deco: [terminal: 4]); a host's registered icon on top with icon: NAME.
terminalterminal1.6 × 1.2 × 0.8termA small box with terminal lines: a command, a listener, a dashboard.
serverserver3 × 2.2 × 0.9dozA daemon or service: a low box with two lines.
chatchat3.6 × 4.4 × 1.3chatA chat server or room: a chat bubble on top.
mailboxmailbox2.4 × 2.4 × 1.6mailA room or inbox: terminal lines and an envelope on top.
filefile1.6 × 1.6 × 0.6fileA file or document: lines on top.
folderfolder1.6 × 1.6 × 0.5folderA folder: a flat box. Put file nodes on it with its own nodes:.
keykey1.6 × 1.6 × 0.6keyA secret or keychain item: a key on top.
socketsocket1.2 × 1.2 × 0.5socketA socket: a round opening on top.
gategate0.3 × 2 × 1.1gateA gate or proxy: a narrow upright slab. Name it as a fence's gate.node and the fence places it in its wall.
placeholderplaceholder1.2 × 1.0 × 0.45placeholderA placeholder value: a small box with lines.
cloudcloud3 × 2.4 × 0.3cloudA cloud lying on the floor: the internet, a hosted service.
orborb1.5 × 1.5 × 1.6leadAn agent as a character: a white sphere with eyes, on a plate coloured by its role.
personperson1.5 × 1.5 × 1.6personA human. Its label sits to the right.
screenscreen1.64 × 0.3 × 1.75termAn upright screen. face: terminal (default), chat, desktop, tiles (a grid of terminals), or a face the host registers; facing: turns it (degrees).
monitormonitor2.4 × 0.8 × 1.8termA block with a screen painted on its front-left face; face: as for screen.
volumevolume1.8 × 1.8 × 1.3folderStored data that is kept: a drum with two bands. A volume, a store's history, an archive.

Decorations#

deco: is a list; each item is a word or a one-key map:

DecorationWhereExample
terminal or terminal: NN lines (1–8, default 3) on the front-left facedeco: [terminal: 4]
icon: NAMEAn icon the host registers (objects.registerMarks), laid flat on the top face; none is built in (0.9.0). A name nothing registered draws a dashed placeholder, and the compile warnsdeco: [icon: NAME]
envelopeAn envelope on topdeco: [envelope]
bubbleA chat bubble on topdeco: [bubble]
file-linesTwo lines of text on topdeco: [file-lines]
ghostDashed outline only: stopped, or not built (same as ghost: true)ghost: true

An asset's own decorations are replaced when a node gives deco:.

Region kinds#

Use with kind: on a region. A region without size grows to fit what is in it, plus padding.

KindPictureHeightLabelWhat it is
slabslabthick base, top at 0.35On its front faceA machine: "app host". Padding 1.2.
padpad0.2On the floorA small plate for someone's things: a person and their screens.
vmvm0.45, tintedOn its front faceA sandbox: a raised plate; its contents stand on it.
platformplatform0.7, tintedOn its right faceA server holding parts: rooms, a directory. Routes climb onto it.
fencefencewalls 0.8On its front wallA cage: translucent walls, back walls behind its contents and front walls over them. gate: { side, at, width, height, node } opens one wall and puts a node in it.
cloudcloud0.2On the floorAn area of the internet or a hosted service.
zonezoneflatOn the floorA tinted area with a dashed edge: grouping without a surface.
tunneltunnel0.8, lifted by zAlong its sideA translucent tube, such as a Tailscale tunnel. around: [route ids] lights it with those routes.

Colour roles#

Roles are hue and saturation pairs in the theme (themes/default.yaml, roles:): slab, pad, lead (blue), work (green), violet, doz / grey / cursor (grey), chat / mail (teal), file, folder, key, gate, cloud, event (pink), placeholder, term / person (purple), socket, fence, sandbox, server, belt, bot, blue, green. A file adds its own under roles::

roles:
  brand: { h: 12, s: 70 }            # hue 0–360, saturation 0–100
  glass: { h: 205, s: 40, tint: 15 } # top face: 15% of the colour mixed into the pad colour

Adding an asset#

An asset is a TypeScript object in src/iso-systems/nodes.ts (or its own file), added to NODE_ASSETS:

const antenna: NodeAsset = {
  name: 'antenna',
  description: 'A radio mast on a small base.',
  size: [1.2, 1.2, 2.4],          // default box, grid units
  role: 'grey',                   // default colour role
  draw(k, b, n) {                 // k: the kernel, b: the node's box, n: the node from the YAML
    const base = { ...b, z1: b.z0 + 0.3 };
    const [cx, cy] = [(b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2];
    return k.blockFaces(base) + k.line3([cx, cy, base.z1], [cx, cy, b.z1], 'det');
  },
  // optional: label(b, n, hasSub) to move its label, pulse(b) to place its step pulse
};

The kernel (src/iso-core/kernel.ts) gives iso(x, y, z), blockFaces(box) (the three shaded faces with the reference classes), poly, line3, onFace(box, 'top' | 'left' | 'right', draw) to paint in a face's own 2D pixel space, and floorText / faceText. Use the classes top, lft, rgt for faces and det for detail lines, and the theme does the rest. Then add a row to this file and run scripts/asset-pics.ts.