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

Text not readable with fill styling when htmlLabels false #885

Closed
stanhu opened this issue Jul 21, 2019 · 1 comment · Fixed by #886
Closed

Text not readable with fill styling when htmlLabels false #885

stanhu opened this issue Jul 21, 2019 · 1 comment · Fixed by #886

Comments

@stanhu
Copy link
Contributor

stanhu commented Jul 21, 2019

Describe the bug

When htmlLabels is set to false, the text in a flow diagram doesn't show when styling the background.

To Reproduce

Initiate Mermaid with htmlLabels: false and use this diagram:

graph LR

SavePropertyController --> SavePropertyCommand
SavePropertyCommand --> SavePropertyCommandHandler
SavePropertyCommandHandler --> EventElastica[elastica.postupdate]
SavePropertyCommandHandler --> EventProperty[property.postdisable]

SavePropertyController --> Exceptions
Exceptions --> ExceptionList(SecurityException<br/>EmptyRequestBodyException<br/>Throwable)

classDef Ui fill:#FFFFFF
classDef object fill:#1E98EC
classDef event fill:#ECB11E

class EventElastica,EventProperty event
class SavePropertyCommand,SavePropertyCommandHandler object
class SavePropertyController Ui

Expected behavior

When htmlLabels: true, this is how it looks:

image

Screenshots

However, this is what actually happens:

image

The htmlLabels: true case produces this:

image

While htmlLabels: false case produces this:

image

Desktop (please complete the following information):

MacOS Mojave 10.14.12
Chrome 75.0.3770.142

@stanhu stanhu changed the title Text not readable with styling when htmlLabels false Text not readable with fill styling when htmlLabels false Jul 21, 2019
@stanhu
Copy link
Contributor Author

stanhu commented Jul 21, 2019

It looks like the tspan element needs a fill argument:

diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js
index 3fb9a31..1d7eb46 100644
--- a/src/diagrams/flowchart/flowRenderer.js
+++ b/src/diagrams/flowchart/flowRenderer.js
@@ -79,6 +79,7 @@ export const addVertices = function (vert, g, svgId) {
         tspan.setAttribute('dy', '1em')
         tspan.setAttribute('x', '1')
         tspan.textContent = rows[j]
+        tspan.setAttribute('fill', 'black')
         svgLabel.appendChild(tspan)
       }
       vertexNode = svgLabel

stanhu added a commit to stanhu/mermaid that referenced this issue Jul 21, 2019
When htmlLabels is set to `false` and a background fill color is used
for a node, the text label will inherit the fill color, hiding the
actual text. To fix this, explicitly set the fill color to mermaid-js#333.

Closes mermaid-js#885
stanhu added a commit to stanhu/mermaid that referenced this issue Jul 21, 2019
When htmlLabels is set to `false` and a background fill color is used
for a node, the text label will inherit the fill color, hiding the
actual text. To fix this, explicitly set the fill color to `mermaid-js#333`, the
same value used in `src/themes/flowchart.scss`.

Closes mermaid-js#885
@knsv knsv closed this as completed in #886 Jul 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant