Styling¶
Styling is a small, documented subset of CSS. predictygraph resolves it itself and writes plain presentation attributes, so the SVG looks the same everywhere.
graph theme=nord
css "theme.css" # external stylesheet, next to the .pdg file
css {
node.db { fill: #e0f2fe; stroke: #0284c7; }
edge.hot { stroke: #dc2626; stroke-width: 3; flow: forward; }
#k8s node { font-weight: 600; }
}
Selectors¶
node, edge, group, graph, label, .class, #id, compounds (node.db) and
group descendants (#cluster node). Specificity and source order follow CSS.
Text parts have their own selectors: sub (the sub= second line), step (numbered
circles on edges), legend, caption and bracket (side brackets). Scope them like
descendants: node.core sub { color: #dcfce7; }.
Precedence: built-in defaults < stylesheets < default statements < inline attributes.
Properties¶
- Box:
fill,stroke,stroke-width,stroke-dasharray,border-radius,padding,min-width,min-height,opacity,shadow,accent-bar(4px #16a34a, a strip inside the left edge),accent-side,title-fill(groups: a band behind the title),label-position: top|bottom|left(groups;leftturns the title vertical) - Text:
color,font-family,font-size(emand%are relative to the owner),font-weight,font-style,text-align - Edge:
stroke,stroke-width,stroke-dasharray,arrow,head,route - Variables:
--name: valueandvar(--name, fallback)
Themes¶
For ready-made colour schemes, set graph theme=NAME. See Themes for all twelve, side by side.
Your own CSS is applied on top of the theme.
Example stylesheet¶
/*
* SPDX-FileCopyrightText: 2026 Reza Jelveh
*
* SPDX-License-Identifier: CC-BY-4.0
*/
:root { --brand: #0f766e; --hot: #dc2626; --ink: #1f2937; }
graph { font-family: "DejaVu Sans"; background: #ffffff; }
node { border-radius: 8px; stroke: #475569; shadow: soft; }
node.hami { fill: #ccfbf1; stroke: var(--brand); color: #134e4a; font-weight: bold; }
node.gpu { fill: #eef2ff; stroke: #6366f1; font-size: 12px; min-width: 70px; }
group { fill: #f8fafc; stroke: #cbd5e1; stroke-dasharray: 4 3; }
#mon { fill: #fff7ed; stroke: #fdba74; }
edge.hot { stroke: var(--hot); color: var(--hot); font-weight: bold; }