Themes
Colours, fonts, styles and page chrome in one directory.
A theme is a directory containing theme.yaml plus its assets (fonts, icons, logos). It supplies
colours, fonts, node, edge and zone styles, icons and page chrome, so the same diagram source renders
in any brand.
Start with extends: default and override only what differs:
name: acme
extends: default
colors:
primary: "#0F766E"
primary-strong: "#115E59"
primary-deep: "#134E4A"Select a theme with --theme (a directory or a name) or the SPINAGRAM_THEME environment
variable. In Python, pass theme= to d.save(...) or spinagram.render(...).
Themes by name
A name such as --theme acme (or extends: acme) is looked up in this order:
- the built-in themes;
- a directory with that path: relative to the theme that extends it, then to the working directory;
<dir>/acme/theme.yamlfor each directory inSPINAGRAM_THEME_PATH(separated by:,;on Windows);- the
acmeentry point in thespinagram.themesgroup of an installed package.
A path (./acme, ~/themes/acme, /abs/acme) is only looked up as a path. A brand package registers its theme
directory, either as the package itself or as an attribute holding the path:
[project.entry-points."spinagram.themes"]
acme = "acme_theme" # the package directory holds theme.yaml
acme-dark = "acme_theme.paths:DARK" # DARK is the path of a directory with theme.yamlWhen nothing matches, the error lists every place searched, in order:
theme 'acme' not found; searched, in order:
1. built-in themes (default, …)
2. /work/acme
3. /opt/themes/acme (SPINAGRAM_THEME_PATH)
4. entry point 'acme' in group 'spinagram.themes' (none installed)Glyph map
When the brand font lacks a character, text.glyph_map replaces it before layout, in every text of the
diagram, fact values included:
text:
glyph_map: {"→": "->", "✓": "OK"}Keys are single characters; values are strings. check lists each replacement as glyph-mapped (P2):
'→' (U+2192) replaced by '->' (theme glyph_map). A mapped character is not reported as glyph-missing.
Node and icon defaults
| Key | Default | Meaning |
|---|---|---|
defaults.node.icon_text_gap | 8 | Space between a centred icon and the text below it |
defaults.node.icon_min | 24 | Smallest size a centred icon shrinks to before the text shrinks |
icons.prefer_vendor_for_services | false | Swap a generic icon for the vendor icon a box title names; see Layout engine |
Provider zone styles
The default theme draws zones in the diagramming style of each cloud provider: the provider's outline colour,
dashed or solid, and its group icon in the top-left corner, flush with the outline. Use the name as a zone's
color: in YAML or a group's style= in Python, or pick it in the canvas editor
palette. The icons come from the provider's icon pack, so download that pack first (spinagram icons fetch aws, or
Fetch in the palette).
zones:
- {id: vpc, label: "VPC 10.0.0.0/16", color: aws-vpc, x: 96, y: 356, w: 984, h: 600}| Provider | Styles | Notes |
|---|---|---|
| AWS | aws-cloud, aws-account, aws-region, aws-vpc, aws-az, aws-public-subnet, aws-private-subnet, aws-auto-scaling-group, aws-corporate-dc, aws-spot-fleet, aws-server-contents, aws-ec2-contents | The colours and icons of the AWS Architecture Icons groups. aws-az has no icon, as in AWS diagrams. aws-subnet is the earlier name of aws-private-subnet |
| Azure | azure-management-group, azure-subscription, azure-resource-group, azure-vnet, azure-subnet | Follows the nesting of Microsoft's architecture diagrams |
| Google Cloud | gcp-cloud, gcp-project, gcp-region, gcp-zone, gcp-vpc, gcp-subnet | Coloured areas as in Google's diagram templates. Region, zone and subnet have no icon |
| Kubernetes | k8s-cluster, k8s-namespace | The Kubernetes icon set has no cluster icon, so k8s-cluster has none |
Only AWS publishes official group colours. The Azure and Google Cloud colours follow their diagram templates, so
compare them with the provider's current guidance when exact brand colours matter. Each block of theme.yaml cites
its sources. A theme can add its own zone styles; the palette lists every zone style of the active theme.
src/spinagram/themes/default/theme.yaml
documents every key: canvas, colors, font roles (with font files for metrics and embedding),
styles for nodes, edges, zones, legends and tables, icons, and page chrome.
spinagram serve has a Themes tab that shows the token sheet of the active theme: colours,
fonts, styles with previews and chrome. See Live UI.