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

Allow user to disable setting of certain CSS styles #5466

Open
torfjelde opened this issue Apr 16, 2024 · 0 comments
Open

Allow user to disable setting of certain CSS styles #5466

torfjelde opened this issue Apr 16, 2024 · 0 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@torfjelde
Copy link

Proposal

I'm currently trying to use Mermaid.js to describe some piece of code, and hence want syntax highlighting for both labels and edge labels.

One simple way to achieve this is to allow HTML labels and write raw HTML that will be styled accordingly (using, say, highlight.js).

Buuut it seems that there is just no possibility of overriding certain attributes due to arguably too strong CSS rules on defined on the side of Mermaid.js.

In particular, the following style

export interface FlowChartStyleOptions {
arrowheadColor: string;
border2: string;
clusterBkg: string;
clusterBorder: string;
edgeLabelBackground: string;
fontFamily: string;
lineColor: string;
mainBkg: string;
nodeBorder: string;
nodeTextColor: string;
tertiaryColor: string;
textColor: string;
titleColor: string;
}

makes it so one cannot change the color of individiual spans inside a label, which is essential to make use of something like highlight.js.

Hence I was wondering if it would be possible to maybe make some attributes, e.g. color, to only be optionally set.

Thoughts? 😬

Example

I'm imagining something like

mermaid.initialize({
  theme: "base",
  themeVariables: {
    textColor: null
  }
});

would result in all rules based on textColor be left unset by Mermaid.js.

This would then allow more heavy customization on the user end.

An alternative, which is maybe simpler to implement, would be to add some configuration flag which replaces the usage of ID based ruling completely. I know this might cause significant issues on the rendering in many cases, but I think for advanced users this will be incredibly useful as they can then just take complete control of the styling of labels, etc. by using more specific rules.

Screenshots

No response

@torfjelde torfjelde added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request labels Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant