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.
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.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
| Variable | Where | Role |
|---|---|---|
--c | card or zone type | accent colour; a zone passes it on to its untyped cards |
--label | card type | badge or chip text |
--look | card type | band, header, classic or eyebrow (below) |
--on-c | type | colour of text set on the accent (default white) |
--z-bg, --z-border, --z-ink | zone type | explicit zone tints, instead of the derived ones |
--icon | type | default icon of the type (preview) |
--zone-pad, --zone-head | :root | zone margins, used by the layout |
--bg, --surface, --ink, --ink-2, --muted, --line,
--card-border | :root | base colours, redefined by each theme (for the dark one: .stage.theme-dark) |
--font, --mono, --radius | :root | typography and corner radius |
--font-scale | .stage | multiplies 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:
band (default): the name in a coloured band, the chip on the right
header: the type in the band, the name centred below
classic: an accent line on top, a badge before the name
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.
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.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.
