Skip to content

Style class diagram elements based on stereotype annotations like <<abstract>>, <<interface>>, etc. #6587

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

Open
NourBenz opened this issue May 11, 2025 · 0 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@NourBenz
Copy link
Contributor

NourBenz commented May 11, 2025

Proposal

Mermaid.js should add support for automatic visual styling of class diagram elements when stereotype annotations are used.

Currently, these annotations only appear as plain text inside the class block. But they could provide much more value by being interpreted visually (just like in traditional UML tools).

This would:

  • Improve readability in large diagrams

  • Make the roles of classes visually distinct

  • Align with UML best practices

  • Provide accessibility value (e.g., color/weight cues for visually scanning diagrams)

Example

Maybe we should aim for the kind of visual where :

classDiagram
class Shape {
    <<abstract>>
    noOfVertices
    draw()
}
class Drawable {
    <<interface>>
    draw()
}
class Color {
    <<enumeration>>
    RED
    BLUE
    GREEN
    WHITE
    BLACK
}
class Circle

Would have :

  • Shape name is rendered in italic because it's abstract

  • Drawable name is rendered in bold to indicate it's an interface

  • Color is underlined to show it's for enum items

  • Circle is styled normally as a standard class

Screenshots

Current visual :

Image

Mockup :

Image

@NourBenz NourBenz added Type: Enhancement New feature or request Status: Triage Needs to be verified, categorized, etc labels May 11, 2025
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