Skip to content

Accept CSS variables for theme #6677

@tuyen-at-work

Description

@tuyen-at-work

Proposal

Please consider adding support for using CSS variables in themes.

Example:

Mermaid:

config:
  themeVariables:
    git1: --danger

CSS:

:root {
  --danger: red;
}

[data-theme='dark'] {
  --danger: orange;
}

Use case:

For sites that already support multiple themes (such as light/dark modes) through a system of CSS variables, allowing Mermaid to reference these variables would significantly improve visual consistency between Mermaid diagrams and the rest of the site. It would also enable diagrams to automatically adapt when the user switches themes — something that is not currently customizable.

Colors

Support CSS variables for all colors.

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions