Skip to main content

Styles

Under --- styles, each line is one rule:

selectors: properties

Selectors are references, several separated by commas, and a selector applies to every match. Later rules override earlier ones.

Z H H

--- styles
Z, H: rect fill=#fef3c7
Z: fill=#bfdbfe

Shapes​

Shapes and their attributes are a subset of SVG, with SVG's names:

KindNames
Shapesrect, circle, ellipse, polygon, path, image
Shape attributesfill, stroke, stroke-width, stroke-dasharray, opacity, r, rx, ry, width, height, points, d, viewBox, href
Text attributesfill, font-size, font-weight, font-style, font-family
Line and arrow attributesstroke, stroke-width, stroke-dasharray, opacity

A shape keyword gives the token a shape; the attributes after it belong to it. Shapes default to a white fill and a 1px black stroke, and size to their text unless width, height or r is given. Text defaults to 14px sans-serif and is drawn on top.

Start Step Done

--- styles
Start: rect rx=999 fill=#dcfce7
Step: rect
Done: circle fill=#fde68a

rx alone rounds the corners into circles capped at half the shorter side, so rect rx=999 is a pill.

Where a property goes​

  • font-*, align and wrap always style the text, and z-index the token, wherever they're written.
  • fill, stroke and sizes style the shape they follow, or the token's shape if the rule names none, or its text if the token has no shape.
  • To color the text of a shaped token, use its text part: ::text fill=white.

Parts​

A token can have several shapes, drawn in the order written. ::name names a part so a later rule can change it, and ::text is the built-in text part:

A B C

--- styles
A..C:
circle r=16 fill=#dbeafe
::ring circle r=20 stroke=teal fill=none
B::ring: stroke=red
B: ::text fill=red

::text hidden hides the text, for tokens whose text is only a name:

A B

--- styles
A: circle r=12 fill=#EBE3CF ::text hidden
B: circle r=30 fill=#DC933C ::text hidden

Sizes​

width and height on a token fix its size, so wider neighbors don't resize it. Equal sizes come from equal columns and rows: give a row's cells a width (@r3: width=140).

A percentage is a share of the token's cells, spans and the gaps between them included. rect width=100% height=100% fills them, as CSS grid's stretch does. A percentage never makes a shape smaller than its text.

a < <
b c d

--- styles
a..d: rect width=100% height=100% fill=#ececff stroke=#9370db

Custom shapes​

A polygon or path with a viewBox is drawn in those coordinates and stretched to the token's size; strokes keep their width. Give custom shapes a width and height:

"Is it?"

--- styles
"Is it?": polygon points="50,0 100,50 50,100 0,50" viewBox="0 0 100 100" width=110 height=64

image href=… draws an image from a URL or path; Diya ships no icon set.

Text​

align (left, right, center) aligns a token in its cell, and wrap=N wraps its text at N pixels.

Connectors​

Arrows and lines are styled through their relation's #id or .class. Besides the line attributes above:

  • curved makes a path between two stops a curve. It bows up (a vertical one to the right), deeper if that clears the tokens in its way (at most half its length), and two curves between the same tokens in opposite directions form a lens.
  • curved=left / curved=right choose the side, seen traveling along the arrow. The curve stays on that side and leaves each token on it.
  • start=center / end=center attach an end at a token's center instead of its edge.
A B

--- relations
arrow.go A B
arrow.back B A

--- styles
A, B: circle r=16
.go, .back: curved
.back: stroke-dasharray=4

Drawing order​

z-index=N sets the layer (default 0; higher is on top). Within a layer, boxes are drawn first (larger first), then tokens, then lines and arrows, each in relation order.