Skip to content

Usecase Diagram Config Schema ​

txt
https://mermaid.js.org/schemas/config.schema.json#/$defs/UsecaseDiagramConfig

包含用例图特定配置的对象。

AbstractExtensibleStatusIdentifiableCustom PropertiesAdditional PropertiesAccess RestrictionsDefined In
Can be instantiatedNoUnknown statusNoForbiddenAllowednoneconfig.schema.json*

UsecaseDiagramConfig Type ​

object (Usecase Diagram Config)

all of

UsecaseDiagramConfig Properties ​

PropertyTypeRequiredNullableDefined by
themestringOptionalcannot be nullMermaid Config
lookstringOptionalcannot be nullMermaid Config
wrappingWidthnumberRequiredcannot be nullMermaid Config
minNodeWidthnumberRequiredcannot be nullMermaid Config
actorFontSizenumberOptionalcannot be nullMermaid Config
actorFontFamilystringOptionalcannot be nullMermaid Config
actorFontWeightstringOptionalcannot be nullMermaid Config
usecaseFontSizenumberOptionalcannot be nullMermaid Config
usecaseFontFamilystringOptionalcannot be nullMermaid Config
usecaseFontWeightstringOptionalcannot be nullMermaid Config
nodeSpacingnumberOptionalcannot be nullMermaid Config
rankSpacingnumberOptionalcannot be nullMermaid Config
diagramPaddingnumberOptionalcannot be nullMermaid Config
colorSchemestringOptionalcannot be nullMermaid Config

theme ​

主题,CSS 样式表。你也可以使用 themeCSS 覆盖此值。

theme

theme Type ​

string

theme Constraints ​

enum: the value of this property must be equal to one of the following values:

ValueExplanation
"default"
"base"
"dark"
"forest"
"neutral"
"neo"
"neo-dark"
"redux"
"redux-dark"
"redux-color"
"redux-dark-color"
"null"Can be set to disable any pre-defined mermaid theme

theme Default Value ​

The default value is:

json
"redux-color"

look ​

定义图表要使用的主要外观。

look

look Type ​

string

look Constraints ​

enum: the value of this property must be equal to one of the following values:

ValueExplanation
"classic"
"handDrawn"
"neo"

look Default Value ​

The default value is:

json
"neo"

wrappingWidth ​

文本换行的节点宽度。使用 Markdown 字符串时,文本会自动换行,此值设置文本在换行前的最大宽度。

wrappingWidth

wrappingWidth Type ​

number

wrappingWidth Default Value ​

The default value is:

json
120

minNodeWidth ​

节点标签区域的最小宽度。比这个宽的标签会被加宽,所以短文本的节点也会有统一的宽度;节点自身的内边距会叠加上去,就像 wrappingWidth 的情况一样。设置了明确宽度的节点不受影响。

minNodeWidth

minNodeWidth Type ​

number

minNodeWidth Default Value ​

The default value is:

json
120

actorFontSize ​

角色标签的字体大小

actorFontSize

actorFontSize Type ​

number

actorFontSize Constraints ​

minimum: the value of this number must greater than or equal to: 1

actorFontSize Default Value ​

The default value is:

json
14

actorFontFamily ​

演员标签的字体系列。逐字写入到内联 CSS 自定义属性中,因此可能出现的字符 terminate a declaration or open a new one are excluded: ;, <, >, (, ), {, }, and \. Quotes, commas, and spaces stay allowed for font stacks such as "Open Sans", sans-serif.

actorFontFamily

actorFontFamily Type ​

string

actorFontFamily Constraints ​

pattern: the string must match the following regular expression:

javascript
/^[^;<>(){}\\]*$/

try pattern

actorFontFamily Default Value ​

The default value is:

json
"\"Open Sans\", sans-serif"

actorFontWeight ​

演员标签的字体粗细。仅限于 CSS 的 font-weight 关键字和数值粗细,因为这个值会直接写入内联 CSS 自定义属性。

actorFontWeight

actorFontWeight Type ​

string

actorFontWeight Constraints ​

pattern: the string must match the following regular expression:

javascript
/^(normal|bold|bolder|lighter|inherit|initial|revert|unset|[1-9][0-9]{0,3})$/

try pattern

actorFontWeight Default Value ​

The default value is:

json
"normal"

usecaseFontSize ​

用例标签的字体大小

usecaseFontSize

usecaseFontSize Type ​

number

usecaseFontSize Constraints ​

minimum: the value of this number must greater than or equal to: 1

usecaseFontSize Default Value ​

The default value is:

json
12

usecaseFontFamily ​

用于用例标签的字体系列。约束方式与 actorFontFamily 相同。

usecaseFontFamily

usecaseFontFamily Type ​

string

usecaseFontFamily Constraints ​

pattern: the string must match the following regular expression:

javascript
/^[^;<>(){}\\]*$/

try pattern

usecaseFontFamily Default Value ​

The default value is:

json
"\"Open Sans\", sans-serif"

usecaseFontWeight ​

用例标签的字体粗细。约束方式与 actorFontWeight 相同。

usecaseFontWeight

usecaseFontWeight Type ​

string

usecaseFontWeight Constraints ​

pattern: the string must match the following regular expression:

javascript
/^(normal|bold|bolder|lighter|inherit|initial|revert|unset|[1-9][0-9]{0,3})$/

try pattern

usecaseFontWeight Default Value ​

The default value is:

json
"normal"

nodeSpacing ​

同一级别节点之间的间距

nodeSpacing

nodeSpacing Type ​

number

nodeSpacing Constraints ​

minimum: the value of this number must greater than or equal to: 0

nodeSpacing Default Value ​

The default value is:

json
50

rankSpacing ​

不同层节点之间的间距

rankSpacing

rankSpacing Type ​

number

rankSpacing Constraints ​

minimum: the value of this number must greater than or equal to: 0

rankSpacing Default Value ​

The default value is:

json
50

diagramPadding ​

整个图表周围的内边距

diagramPadding

diagramPadding Type ​

number

diagramPadding Constraints ​

minimum: the value of this number must greater than or equal to: 0

diagramPadding Default Value ​

The default value is:

json
20

colorScheme ​

用例图的颜色如何从活动主题中获取。role(默认)会给每种元素分配一种颜色,这些颜色取自 usecaseActorBkg / usecaseActorBorder、usecaseBkg / usecaseBorder 和 usecaseBoundaryBkg / usecaseBoundaryBorder 主题变量。颜色表示元素的“类型”,在插入、重新排序和重命名时保持不变——在中间添加一个用例不会重新着色后面的元素,因此差异对比、文档截图和视觉基线都保持稳定。而 rotate 则会给每个角色、用例和系统边界分配主题类别调色板(borderColorArray / bkgColorArray)中的独立槽,就像 ER 实体和类框的着色方式一样。角色和用例共享一个循环,而系统边界从零开始运行第二个循环,因此边界不会被迫与其中的元素匹配。在共享循环中,角色优先编号,用例紧随其后,按声明顺序排列——因此交错的 actor A、usecase U、actor B 的编号是 A、B、U,而不是 A, U, B. This buys per-instance variety at the cost of the stability role has: inserting an element shifts the colour of every later element of its own kind, and inserting an actor shifts the use cases too. Only the colour themes (redux-color, redux-dark-color) carry a palette, so on every other theme the two settings render identically.

classDef and style keep overriding both, whichever is set.

colorScheme

colorScheme Type ​

string

colorScheme Constraints ​

enum: the value of this property must be equal to one of the following values:

ValueExplanation
"role"
"rotate"

colorScheme Default Value ​

The default value is:

json
"role"
Opens in mermaid.ai