mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-17 06:20:07 +02:00
Support Custom CSS
This commit is contained in:
1
dist/index.html
vendored
1
dist/index.html
vendored
@@ -109,6 +109,7 @@ Class08 <--> C2: Cool label
|
|||||||
<script>
|
<script>
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
|
themeCSS: '.node rect { fill: red; }',
|
||||||
logLevel: 3,
|
logLevel: 3,
|
||||||
gantt: { axisFormat: '%m/%d/%Y' },
|
gantt: { axisFormat: '%m/%d/%Y' },
|
||||||
sequence: { actorMargin: 50 },
|
sequence: { actorMargin: 50 },
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mermaid",
|
"name": "mermaid",
|
||||||
"version": "8.0.0-alpha.9",
|
"version": "8.0.0-beta.1",
|
||||||
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
|
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
|
||||||
"main": "dist/mermaid.core.js",
|
"main": "dist/mermaid.core.js",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@@ -50,6 +50,7 @@ for (const themeName of ['default', 'forest', 'dark', 'neutral']) {
|
|||||||
*/
|
*/
|
||||||
const config = {
|
const config = {
|
||||||
theme: 'default',
|
theme: 'default',
|
||||||
|
themeCSS: undefined,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* logLevel , decides the amount of logging to be used.
|
* logLevel , decides the amount of logging to be used.
|
||||||
@@ -380,8 +381,15 @@ const render = function (id, txt, cb, container) {
|
|||||||
const svg = element.firstChild
|
const svg = element.firstChild
|
||||||
const firstChild = svg.firstChild
|
const firstChild = svg.firstChild
|
||||||
|
|
||||||
|
// pre-defined theme
|
||||||
|
let style = config.theme !== undefined ? themes[config.theme] : ''
|
||||||
|
|
||||||
|
// user provided theme CSS
|
||||||
|
if (config.themeCSS !== undefined) {
|
||||||
|
style += `\n${config.themeCSS}`
|
||||||
|
}
|
||||||
|
|
||||||
// classDef
|
// classDef
|
||||||
let style = themes[config.theme] || themes.default
|
|
||||||
if (graphType === 'flowchart') {
|
if (graphType === 'flowchart') {
|
||||||
const classes = flowRenderer.getClasses(txt)
|
const classes = flowRenderer.getClasses(txt)
|
||||||
for (const className in classes) {
|
for (const className in classes) {
|
||||||
|
1
todo.md
1
todo.md
@@ -2,4 +2,3 @@
|
|||||||
- git graph requires a blank line at the end. why?
|
- git graph requires a blank line at the end. why?
|
||||||
- Create a desktop client
|
- Create a desktop client
|
||||||
- Flowchart `interpolate` is useless because there is no rendering code using it
|
- Flowchart `interpolate` is useless because there is no rendering code using it
|
||||||
- How to use custom theme?
|
|
||||||
|
Reference in New Issue
Block a user