Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to customise themes for mermaid diagrams inside a markdown #76

Open
alexwall opened this issue May 20, 2019 · 3 comments
Open

unable to customise themes for mermaid diagrams inside a markdown #76

alexwall opened this issue May 20, 2019 · 3 comments

Comments

@alexwall
Copy link

Using the standalone preview for mermaid works:

image

Focus the cursor into the diagram on the left.
Diagram on the right uses the new theme.
image

Preview as a part of a markdown preview doesn't use the customised theme (on the left).
[cmd]+[shift]+[V]

image

The customisation is not working for markdown embedded previews.

@ristomatti
Copy link

At least nowadays it seems to work fine with either the init directive or within settings.json.

Curiously in settings.json you'll need to use a nested structure (exactly as documented in the README), which VSCode does not recognize as known settings.

::: mermaid
%%{init: {
  "theme": "dark",
  "themeCSS": ".cardinality text { fill: #ededed }",
  "themeVariables": {
    "primaryTextColor": "#ededed",
    "nodeBorder": "#393939",
    "mainBkg": "#292929",
    "lineColor": "orange"
  }
}}%%
graph TD;
A[Christmas] --> |Get Money| B(Go Shopping)
B --> C{Let me think}
C --> |One| D[Laptop]
C --> |Two| E[iPhone]
C --> |Three| F((Car))
F --> |back| B
Comment> This is comment]
Comment --- C
:::

image

@vstirbu
Copy link
Collaborator

vstirbu commented Sep 1, 2022

@ristomatti would it be correct to say that your previous comment can be translated into something like the ability to define the init structure as part of the configuration, and if the value is provided the plugin to append it to the diagram in the preview panel:

You type this

::: mermaid
graph TD;
A[Christmas] --> |Get Money| B(Go Shopping)
B --> C{Let me think}
C --> |One| D[Laptop]
C --> |Two| E[iPhone]
C --> |Three| F((Car))
F --> |back| B
Comment> This is comment]
Comment --- C
:::

and you render this

::: mermaid
%%the value from configuration if provided%%
graph TD;
A[Christmas] --> |Get Money| B(Go Shopping)
B --> C{Let me think}
C --> |One| D[Laptop]
C --> |Two| E[iPhone]
C --> |Three| F((Car))
F --> |back| B
Comment> This is comment]
Comment --- C
:::

@ristomatti
Copy link

That would be helpful and make sense. My comment however was mostly about the unexpected way to set themeCSS in the settings. I don't have the plugin installed anymore so it might have already been fixed but I vaguely remember VSCode showing the syntax that worked as unrecognized settings properties. It's anyway unrelated to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants