Search code examples
mermaid

Mermaid entity relation diagram


I have read mermaid styling documentation section: https://mermaid-js.github.io/mermaid/#/entityRelationshipDiagram?id=styling

Now, I can't figure out how to apply any styles for the ER diagram.There are no any examples or general info about styling.

Does any body have any idea?


Solution

  • I found the answer. The important part of the documentation is "Config options" section. this mean the styles should be placed accordinly. Mermaid config could be placed into mermaid.initialize() or inline on the first line of your digram with %%{init: { }}%% expression. You can see details here https://mermaid-js.github.io/mermaid/#/./directives.

    example for ER diagram styling:

    %%{init: {'themeCSS': '.er.attributeBoxEven { fill: #f2f2f2; }' }}%%