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

classDiagram styling does not work as documented #1649

Open
McShelby opened this issue Aug 25, 2020 · 5 comments · May be fixed by #5880
Open

classDiagram styling does not work as documented #1649

McShelby opened this issue Aug 25, 2020 · 5 comments · May be fixed by #5880
Assignees
Labels
Graph: Class Status: Awaiting PR Type: Bug / Error Something isn't working or is incorrect

Comments

@McShelby
Copy link

The example from the documentation does not change color in the diagram.

<style>
    .cssClass > rect{
        fill:#FF0000;
        stroke:#FFFF00;
        stroke-width:4px;
    }
</style>
classDiagram
    class Animal:::cssClass

This is because the current implementation puts the CSS class cssClass not on the SVG g element but directly on its rect subelement.

The current implementation is sub par because the divider lines between class header, variables and functions require further CSS selectors, otherwise they are not affected by styling.

I think the implementation should be changed to match the documentation.
Additionally the documentation should be changed to have a running example for styling as it is done within previous sections of the document.

  • OS: Windows
  • Browser: FF79
  • Mermaid: 8.7.0
@McShelby McShelby added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Aug 25, 2020
@jgreywolf
Copy link
Contributor

The reason that I went with styling the inner rect is that when styling the g element it does NOT look good at all. For some reason the font style is changing without even having it set to change in my css.

I will continue to look into this.

@McShelby
Copy link
Author

Styling the inner rect is not the problem here but the fact that .cssClass is applied to rect itself not to the containing group!

@jgreywolf jgreywolf self-assigned this Sep 16, 2020
@jgreywolf
Copy link
Contributor

Can someone confirm for me if this is still an issue? As there have been many changes in the past 3 years ;)

I will close this after 30 days if no response

@jgreywolf jgreywolf added Status: Awaiting Reply Close after 30 days Close issue if no response after 30 days labels Jan 26, 2023
@jgreywolf jgreywolf removed their assignment Jan 26, 2023
@McShelby
Copy link
Author

By now (following my previous link to the official documentation), the styling syntax of class Animal:::cssClass seems to be broken and resulting in no diagram at all.

For my test page it just "bombs" the diagram, in the official documentation there just seems to be the text of null be present under the examples.

So, yes, it's still an (now slightly different) issue.

@jgreywolf jgreywolf added Graph: Class and removed Status: Awaiting Reply Close after 30 days Close issue if no response after 30 days labels Jan 30, 2023
@jgreywolf jgreywolf added Contributor needed Status: Approved Is ready to be worked on and removed Status: Triage Needs to be verified, categorized, etc labels Mar 10, 2023
@jgreywolf jgreywolf self-assigned this Apr 5, 2023
@jgreywolf jgreywolf linked a pull request Sep 25, 2024 that will close this issue
4 tasks
@jgreywolf
Copy link
Contributor

This will be resolved with #5880

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Graph: Class Status: Awaiting PR Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants