Menu

Styling with CSS

Classes are types, types are styled in CSS. A type only needs an accent colour and a label; every tint is derived from them.

{"skemo":1,"name":"types.skemo","source":"diagram(dir=\"right\")\n zone#hr.hr Human resources\n card#post.step Post the offer\n to(screen)\n card#screen.step Screen CVs\n to(decide)\n card#decide.choice Decision\n to(hire).ok yes\n to(screen).ko no\n card#hire.end(tag=\"DONE\") Hire\n","css":[{"name":"types.css","content":".step { --c: #5B6CFF; --label: \"STEP\"; }\n.choice { --c: #E8590C; --label: \"?\"; }\n.end { --c: #2B8A3E; }\n.hr { --c: #7048E8; }\n.edge.ok { color: #2B8A3E; }\n.edge.ko { color: #E8590C; }\n.edge.ko .line { stroke-dasharray: 5 4; }\n"}],"theme":"light"}HUMAN RESOURCESSTEPPost the offerSTEPScreen CVs?DecisionHireDONEyesno
{"skemo":1,"name":"types.skemo","source":"diagram(dir=\"right\")\n zone#hr.hr Human resources\n card#post.step Post the offer\n to(screen)\n card#screen.step Screen CVs\n to(decide)\n card#decide.choice Decision\n to(hire).ok yes\n to(screen).ko no\n card#hire.end(tag=\"DONE\") Hire\n","css":[{"name":"types.css","content":".step { --c: #5B6CFF; --label: \"STEP\"; }\n.choice { --c: #E8590C; --label: \"?\"; }\n.end { --c: #2B8A3E; }\n.hr { --c: #7048E8; }\n.edge.ok { color: #2B8A3E; }\n.edge.ko { color: #E8590C; }\n.edge.ko .line { stroke-dasharray: 5 4; }\n"}],"theme":"dark"}HUMAN RESOURCESSTEPPost the offerSTEPScreen CVs?DecisionHireDONEyesno
types.skemo
diagram(dir="right")
  zone#hr.hr Human resources
    card#post.step Post the offer
      to(screen)
    card#screen.step Screen CVs
      to(decide)
  card#decide.choice Decision
    to(hire).ok yes
    to(screen).ko no
  card#hire.end(tag="DONE") Hire
types.css
.step   { --c: #5B6CFF; --label: "STEP"; }
.choice { --c: #E8590C; --label: "?"; }
.end    { --c: #2B8A3E; }
.hr     { --c: #7048E8; }
.edge.ok { color: #2B8A3E; }
.edge.ko { color: #E8590C; }
.edge.ko .line { stroke-dasharray: 5 4; }

The diagram includes its stylesheet by name, next to it: diagram(css="types.css") (several names separated by spaces). Or give it when rendering: skemo types.skemo --css types.css, which can be repeated and applies after the diagram's own. Files apply after the default theme, with the normal cascade.

A type in one line

.server { --c: #5B6CFF; --label: "SERVER"; }

--c is the accent: the band, the border and the tinted background of the card all come from it through color-mix() with the theme's surface colours. --label is the text of the badge or chip (omit it for no badge; tag="…" on a card overrides it). Because nothing else is hard-coded, the same type works in the light, dark and print themes.

Do not set background or text colours on types. Use the variables (var(--surface), var(--ink)…) if you must, or the dark and print themes will break.

Variables

VariableWhereRole
--ccard or zone typeaccent colour; a zone passes it on to its untyped cards
--labelcard typebadge or chip text
--lookcard typeband, header, classic or eyebrow (below)
--on-ctypecolour of text set on the accent (default white)
--z-bg, --z-border, --z-inkzone typeexplicit zone tints, instead of the derived ones
--icontypedefault icon of the type (preview)
--zone-pad, --zone-head:rootzone margins, used by the layout
--bg, --surface, --ink, --ink-2, --muted, --line, --card-border:rootbase colours, redefined by each theme (for the dark one: .stage.theme-dark)
--font, --mono, --radius:roottypography and corner radius
--font-scale.stagemultiplies every text size of the theme, 1.4 for a projected slide (preview); also skemo render --font-scale 1.4

skemo init demo.skemo --css-full writes the whole default theme next to the diagram, included by it: a good starting point for a theme of your own. Given to --base-theme, such a file replaces the default theme instead.

Arrows

An arrow's colour is its color; heads follow it. Lines are SVG paths:

.edge.ok { color: #2B8A3E; }
.edge.ko .line { stroke-dasharray: 5 4; }
.edge.from-uplink { color: #7B5CC4; }    /* every arrow leaving an .uplink card */

Card looks

Four looks, for the whole diagram with diagram(look="…") or per type with --look:

{"skemo":1,"name":"look-band.skemo","source":"diagram(dir=\"right\" look=\"band\")\n card#seg.segment(tag=\"DHCP\") seg-k8s-01\n | 10.1.20.0/28\n to(gw)\n card#gw.gateway Tier-0\n | edge cluster\n","css":[{"name":"look-band.css","content":".segment { --c: #4E9A3E; --label: \"Segment\"; }\n.gateway { --c: #E07B24; --label: \"Gateway\"; }\n"}],"theme":"light"}SEGMENTseg-k8s-01DHCP10.1.20.0/28GATEWAYTier-0edge cluster
{"skemo":1,"name":"look-band.skemo","source":"diagram(dir=\"right\" look=\"band\")\n card#seg.segment(tag=\"DHCP\") seg-k8s-01\n | 10.1.20.0/28\n to(gw)\n card#gw.gateway Tier-0\n | edge cluster\n","css":[{"name":"look-band.css","content":".segment { --c: #4E9A3E; --label: \"Segment\"; }\n.gateway { --c: #E07B24; --label: \"Gateway\"; }\n"}],"theme":"dark"}SEGMENTseg-k8s-01DHCP10.1.20.0/28GATEWAYTier-0edge cluster

band (default): the name in a coloured band, the chip on the right

{"skemo":1,"name":"look-header.skemo","source":"diagram(dir=\"right\" look=\"header\")\n card#seg.segment(tag=\"DHCP\") seg-k8s-01\n | 10.1.20.0/28\n to(gw)\n card#gw.gateway Tier-0\n | edge cluster\n","css":[{"name":"look-header.css","content":".segment { --c: #4E9A3E; --label: \"Segment\"; }\n.gateway { --c: #E07B24; --label: \"Gateway\"; }\n"}],"theme":"light"}SegmentDHCPseg-k8s-0110.1.20.0/28GatewayTier-0edge cluster
{"skemo":1,"name":"look-header.skemo","source":"diagram(dir=\"right\" look=\"header\")\n card#seg.segment(tag=\"DHCP\") seg-k8s-01\n | 10.1.20.0/28\n to(gw)\n card#gw.gateway Tier-0\n | edge cluster\n","css":[{"name":"look-header.css","content":".segment { --c: #4E9A3E; --label: \"Segment\"; }\n.gateway { --c: #E07B24; --label: \"Gateway\"; }\n"}],"theme":"dark"}SegmentDHCPseg-k8s-0110.1.20.0/28GatewayTier-0edge cluster

header: the type in the band, the name centred below

{"skemo":1,"name":"look-classic.skemo","source":"diagram(dir=\"right\" look=\"classic\")\n card#seg.segment(tag=\"DHCP\") seg-k8s-01\n | 10.1.20.0/28\n to(gw)\n card#gw.gateway Tier-0\n | edge cluster\n","css":[{"name":"look-classic.css","content":".segment { --c: #4E9A3E; --label: \"Segment\"; }\n.gateway { --c: #E07B24; --label: \"Gateway\"; }\n"}],"theme":"light"}DHCPSEGMENTseg-k8s-0110.1.20.0/28GatewayTier-0edge cluster
{"skemo":1,"name":"look-classic.skemo","source":"diagram(dir=\"right\" look=\"classic\")\n card#seg.segment(tag=\"DHCP\") seg-k8s-01\n | 10.1.20.0/28\n to(gw)\n card#gw.gateway Tier-0\n | edge cluster\n","css":[{"name":"look-classic.css","content":".segment { --c: #4E9A3E; --label: \"Segment\"; }\n.gateway { --c: #E07B24; --label: \"Gateway\"; }\n"}],"theme":"dark"}DHCPSEGMENTseg-k8s-0110.1.20.0/28GatewayTier-0edge cluster

classic: an accent line on top, a badge before the name

{"skemo":1,"name":"look-eyebrow.skemo","source":"diagram(dir=\"right\" look=\"eyebrow\")\n card#seg.segment(tag=\"DHCP\") seg-k8s-01\n | 10.1.20.0/28\n to(gw)\n card#gw.gateway Tier-0\n | edge cluster\n","css":[{"name":"look-eyebrow.css","content":".segment { --c: #4E9A3E; --label: \"Segment\"; }\n.gateway { --c: #E07B24; --label: \"Gateway\"; }\n"}],"theme":"light"}DHCPSEGMENTseg-k8s-0110.1.20.0/28GATEWAYTier-0edge cluster
{"skemo":1,"name":"look-eyebrow.skemo","source":"diagram(dir=\"right\" look=\"eyebrow\")\n card#seg.segment(tag=\"DHCP\") seg-k8s-01\n | 10.1.20.0/28\n to(gw)\n card#gw.gateway Tier-0\n | edge cluster\n","css":[{"name":"look-eyebrow.css","content":".segment { --c: #4E9A3E; --label: \"Segment\"; }\n.gateway { --c: #E07B24; --label: \"Gateway\"; }\n"}],"theme":"dark"}DHCPSEGMENTseg-k8s-0110.1.20.0/28GATEWAYTier-0edge cluster

eyebrow (preview): a white card, the type as a small coloured label above the name

In every look, a card without a type is drawn light: white, with a hairline border. Colour is left to the types that mean something.

look-header.skemo
diagram(dir="right" look="header")
  card#seg.segment(tag="DHCP") seg-k8s-01
    | 10.1.20.0/28
    to(gw)
  card#gw.gateway Tier-0
    | edge cluster
look-header.css
.segment { --c: #4E9A3E; --label: "Segment"; }
.gateway { --c: #E07B24; --label: "Gateway"; }

Targeting one element

In the SVG and HTML outputs, ids are written as data-id, so several diagrams can share a page. Target one card with an attribute selector:

[data-id="fw"] { --c: #C94A44; }

Other selectors you can rely on: card, zone, card > .title, card li (one per line |), card table, card mark, .edge, .edge .line, .edge .head, .edge .edge-label. An arrow label sits inside its arrow and takes its colour: .edge.ok { color: #2B8A3E; } tints both the line and the label pill (preview). These names belong to the drawing: do not use them as type names.

Fonts (preview)

skemo embeds Inter and JetBrains Mono, and reads no font from the system, so a diagram measures and renders the same everywhere. To use another font, name its family in the CSS and give its files to the renderer, one per weight or style:

.stage { --font: 'Source Serif 4', serif; }
skemo render plan.skemo --css plan.css --font SourceSerif4-Regular.ttf --font SourceSerif4-Bold.ttf

The family, weight and style are read from each file (TrueType or OpenType). The font serves the measure and every output; the HTML embeds it, and so does the SVG with --embed-fonts. A family that no font draws falls back on Inter, with a warning that names it. Use only fonts whose licence allows embedding.