Skip to content

Themes

A theme sets every colour in a diagram with one line:

graph theme=nord

or from the command line, without touching the file:

pdg diagram.pdg --theme dracula

Each sample below is the same diagram. Moving edges and pulsing borders are part of the sample, so you can see how animation looks in each theme.

Light themes

default

default

github-light

github-light

solarized-light

solarized-light

catppuccin-latte

catppuccin-latte

hami

hami

Dark themes

nord

nord

dracula

dracula

gruvbox-dark

gruvbox-dark

solarized-dark

solarized-dark

catppuccin-frappe

catppuccin-frappe

catppuccin-macchiato

catppuccin-macchiato

catppuccin-mocha

catppuccin-mocha

Colour classes

Every theme provides the same classes, so a diagram keeps its meaning when you switch themes:

  • Hues: .red, .orange, .yellow, .green, .cyan, .blue, .purple
  • Roles: .accent (the theme's highlight colour) and .danger
  • Inverted: .solid (text on a filled box)

On a node or group, a class gives a soft fill with a strong outline. On an edge, it colours the line and its label.

db "Store" shape=cylinder .blue
sched -> pool .accent

Your own CSS on top

A theme is applied first, then your stylesheets, so you can change single things:

graph theme=nord
css { node.hami { font-weight: bold; } }

Make your own theme

A theme is a small TOML file. Start from a copy of a built-in one:

schema = 1
name = "my-theme"
dark = true

[palette]          # every colour is #rrggbb
bg = "#2e3440"
surface = "#3b4252"
fg = "#eceff4"
muted = "#d8dee9"
border = "#81a1c1"
red = "#bf616a"
orange = "#d08770"
yellow = "#ebcb8b"
green = "#a3be8c"
cyan = "#88c0d0"
blue = "#81a1c1"
purple = "#b48ead"

[roles]            # optional: which palette colour plays which role
accent = "cyan"
edge = "cyan"

[shape]            # optional
font = "DejaVu Sans"
radius = 6
edge-width = 1.5
  • Use it with graph theme=my-theme.toml (a path next to the diagram) or put it in a folder listed in PDG_THEME_PATH.
  • extends = "nord" starts from another theme and changes only the colours you list.
  • css = """ ... """ (before the first [table]) adds your own rules after the generated ones, with the palette available as variables. The hami theme uses it for header bands, accent bars and grey second lines. With extends, both themes' rules apply, the parent's first.
  • Roles: accent, danger, node-fill, node-stroke, node-text, group-fill, group-stroke, group-text, edge, edge-text.
  • Soft variants (--red-soft and so on) and --bg-alt are mixed automatically.

All palette colours and roles are also CSS variables, for example var(--accent).