@@ -15,7 +15,7 @@ python -m pip install django-mermaid
15
15
16
16
## Configuration
17
17
18
- Add the ` django_mermaid.apps.MermaidConfig ` to your ` INSTALLED_APPS ` setting:
18
+ Add the ` django_mermaid.apps.MermaidConfig ` to your ` INSTALLED_APPS ` in your Django project's ** settings.py ** file.
19
19
20
20
``` python
21
21
INSTALLED_APPS = [
@@ -26,7 +26,8 @@ INSTALLED_APPS = [
26
26
27
27
## Usage
28
28
29
- Once you have installed the app, you can use the ` mermaid ` template tag in your templates.
29
+ After you configure the ` INSTALLED_APPS ` , you will be able to load the ` mermaid ` in your template and use the template
30
+ tag for rendering mermaid diagrams.
30
31
31
32
``` jinja2
32
33
{% load mermaid %}
@@ -47,23 +48,37 @@ the **mermaid.min.js** file.
47
48
48
49
### Mermaid theme
49
50
50
- You can specify the theme right in the template tag dynamically overriding the value of the ` MERMAID_THEME ` variable.
51
+ To set a default theme for the whole project, set the ` MERMAID_THEME ` variable in your Django project's ** settings.py**
52
+ file. However, Django Mermaid uses
53
+ the [ default] ( https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-default.js ) theme of
54
+ mermaid by default. Also, check out the mermaid [ docs] ( https://mermaid.js.org/config/theming.html?#theme-variables ) for
55
+ the available themes.
56
+
57
+ ``` python
58
+ MERMAID_THEME = ' neutral'
59
+ ```
60
+
61
+ Also, you can provide the theme right in the template tag which will dynamically override the value of
62
+ the ` MERMAID_THEME ` variable.
51
63
52
64
``` jinja2
53
65
{% mermaid "graph LR; A-->B;" "dark" %}
54
66
```
55
67
56
- Also, you can set the ` MERMAID_THEME ` variable in your Django project's ** settings.py** file as a default theme.
57
- However, Django Mermaid uses the
58
- [ default] ( https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-default.js ) theme of
59
- mermaid by default.
68
+ ### Mermaid theme variables
69
+
70
+ You can define your custom theme by overriding the ` MERMAID_THEME_VARIABLES ` variable. You will need to use
71
+ the [ base] ( https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-base.js ) theme as it is
72
+ the only modifiable theme. Check out the mermaid [ docs] ( https://mermaid.js.org/config/theming.html?#theme-variables ) for
73
+ the complete and up-to-date list of available theme variables.
60
74
61
75
``` python
62
- MERMAID_THEME = ' neutral'
76
+ MERMAID_THEME_VARIABLES = {
77
+ ' primaryColor' : ' #BB2528' ,
78
+ ' primaryTextColor' : ' #FFF' ,
79
+ }
63
80
```
64
81
65
- The available themes supported by mermaid are listed at mermaid [ docs] ( https://mermaid.js.org/config/theming ) .
66
-
67
82
## Contribute
68
83
69
84
Any contribution is welcome. If you have any ideas or suggestions, feel free to open an issue or a pull request. And
0 commit comments