目录

Mermaid自定义配置主题&样式

在mermaid的代码块最上面直接添加一段配置描述。有两种配置方式可以使用,不同插件支持的程度可能不一样。

方式一

%%{init: {"theme": "neutral", "look": "handDrawn", 
"themeVariables": { "fontSize": "12px", "fontFamily": "LXGW WenKai Mono" } }}%%

flowchart LR
  A --> B
%%{init: {"theme": "neutral", "look": "handDrawn", "themeVariables": { "fontSize": "12px", "fontFamily": "LXGW WenKai Mono" } }}%% flowchart LR A --> B

图1:Flow Chart效果图

方式二

---
config:
  quadrantChart:
    chartWidth: 600
    chartHeight: 300
  themeVariables:
    quadrant1TextFill: "ff0000"
---
quadrantChart
  x-axis Urgent --> Not Urgent
  y-axis Not Important --> "Important ❤"
  quadrant-1 Plan
  quadrant-2 Do
  quadrant-3 Delegate
  quadrant-4 Delete
--- config: quadrantChart: chartWidth: 600 chartHeight: 300 themeVariables: quadrant1TextFill: "ff0000" --- quadrantChart x-axis Urgent --> Not Urgent y-axis Not Important --> "Important ❤" quadrant-1 Plan quadrant-2 Do quadrant-3 Delegate quadrant-4 Delete

图2:Quadrant Chart效果图


引用

不同图类型参数不一样,详细参数可以在官网查询

https://mermaid.js.org/config/theming.html#theme-variables