merIDK / Diagram types / Custom theme
Mermaid custom theme: example and syntax
The base theme is the only Mermaid theme you can fully recolour. Set themeVariables in the frontmatter to match your brand colours and fonts, and every node, line and label follows.
Open this example in the editor
Example code
---
config:
theme: base
themeVariables:
primaryColor: "#fde68a"
primaryBorderColor: "#b45309"
primaryTextColor: "#451a03"
lineColor: "#b45309"
fontFamily: "Georgia, serif"
---
flowchart TB
subgraph Kitchen
direction LR
prep[Prep] --> cook[Cook] --> plate[Plate]
end
order[Order ticket] --> Kitchen --> serve[Serve]
Result
---
config:
theme: base
themeVariables:
primaryColor: "#fde68a"
primaryBorderColor: "#b45309"
primaryTextColor: "#451a03"
lineColor: "#b45309"
fontFamily: "Georgia, serif"
---
flowchart TB
subgraph Kitchen
direction LR
prep[Prep] --> cook[Cook] --> plate[Plate]
end
order[Order ticket] --> Kitchen --> serve[Serve]Syntax quick reference
- Use
theme: base; the other themes ignore most variables. - Key variables:
primaryColor,primaryBorderColor,primaryTextColor,lineColor,fontFamily. - Colours must be hex values such as
"#fde68a", not colour names.
How to use it
- Open the example in the editor, or paste your own Mermaid code.
- Edit the code on the left. The preview updates as you type, and errors point to the line.
- Export SVG or PNG, copy a Markdown block for GitHub or Notion, or copy a share link.