Mermaid-Chart / vscode-mermaid-preview

Previews Mermaid diagrams
MIT License
142 stars 15 forks source link

Allow applying custom themes. #63

Closed Apollo3zehn closed 5 years ago

Apollo3zehn commented 5 years ago

It would be great if this extension would allow applying custom themes as suggested in this post. My aim is to have a similar appearance in vscode like the graph I created in the online editor.

If I understand these lines correctly, the configuration is loaded but unfortunately the fields "theme" and "themeCSS" are overriden. To keep flexibility I would like to suggest to only override these settings if they are not present in the previously loaded config.

vstirbu commented 5 years ago

Seems like a sensible approach to apply the theme and themeCSS if they are available in the loaded configuration. In this case the user would be fully responsible for the end result (e.g. rendering). Would that be ok?

Apollo3zehn commented 5 years ago

If the new behavior is well documented, I think it is a feasable approach.

vstirbu commented 5 years ago

Also one option to use @uifabric/merge-styles and merge the loaded styles into the defaults (e.g. the current ones). With this approach, at least, the customisation starts from a sane state.

Apollo3zehn commented 5 years ago

I had problems overriding defaults, even if I use !important. So if in a config the theme is set to "theme": null (or any other custom theme), there should be no defaults. If - on the other hand - there is no "theme:" but only "themeCSS": defined, then I think @uifabric/merge-styles is a good idea.

vstirbu commented 5 years ago

Ok! Lets leave the user in full control for now. If there is demand to do the merge, it can be done later with merge-styles