question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom css classes for classDiagram nodes

See original GitHub issue

Hi, I’m trying to create bigger models and want to have different colored elements for different types of nodes in my class diagram.

For example, in the next image I would like the Student to be colored orange.

image

In order to do this I’d like to add a custom css class to my model and style the svg accordingly. Is this possible?

If not, the <<something>> notation seems a perfect way of adding a classifier to the resulting SVG.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jgreywolfcommented, Jan 7, 2020

For class diagrams the only way to modify the styling is via the steps outlined in documentation here: http://mermaid-js.github.io/mermaid/#/classDiagram?id=styling

Right now it is not possible to set custom styles for specific/discrete class diagram entities.

This is possible for other diagrams, and that functionality could be ported over from somewhere like how flowchart diagram handles this

1reaction
jgreywolfcommented, Apr 9, 2020

The problem that I have run into with implementing styling is related to the way that members are defined for classes. The use of : between the class name and member means that the parser thinks you are trying to define this relationship when it gets to the class definition.

As you said, I want to keep the implementation the same as it is being used with other diagrams…

Ive been on “hiatus” from the project the past month or so to deal with other issues. You know, just some random things going on with family, the world, whatever 😉

Im getting ready to start up again, and this is one of the main issues I intend to come back to

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use styles with CSS - PlantUML
You can use CSS in some diagrams to change colors and fonts.
Read more >
Styling and Theming | The Official Guide to Mermaid.js
Styling a specific class of a class diagram. In Mermaid, it is possible to supply your own custom CSS styles and apply them...
Read more >
Does a Class Diagram for CSS make sense? - Stack Overflow
I have CSS classes defined for HTML page. now i want to create UML class diagram for the these classes. so what strategy...
Read more >
The Beginner's Guide to CSS Classes - HubSpot Blog
CSS classes help you customize elements on a web page faster and more easily. Using CSS class selectors allows you to set up...
Read more >
Class diagrams - GitHub Pages
The class diagram is the main building block of object-oriented modeling. It is used for general conceptual modeling of the structure of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found