spinagram
Make them yours

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:

my-theme/theme.yaml
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:

  1. the built-in themes;
  2. a directory with that path: relative to the theme that extends it, then to the working directory;
  3. <dir>/acme/theme.yaml for each directory in SPINAGRAM_THEME_PATH (separated by :, ; on Windows);
  4. the acme entry point in the spinagram.themes group 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:

pyproject.toml
[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.yaml

When 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:

my-theme/theme.yaml
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

KeyDefaultMeaning
defaults.node.icon_text_gap8Space between a centred icon and the text below it
defaults.node.icon_min24Smallest size a centred icon shrinks to before the text shrinks
icons.prefer_vendor_for_servicesfalseSwap 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}
ProviderStylesNotes
AWSaws-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-contentsThe 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
Azureazure-management-group, azure-subscription, azure-resource-group, azure-vnet, azure-subnetFollows the nesting of Microsoft's architecture diagrams
Google Cloudgcp-cloud, gcp-project, gcp-region, gcp-zone, gcp-vpc, gcp-subnetColoured areas as in Google's diagram templates. Region, zone and subnet have no icon
Kubernetesk8s-cluster, k8s-namespaceThe 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.

On this page