Skip to content

Commit

Permalink
mermaid-jsgh-50 Allow styling of edge labels in css
Browse files Browse the repository at this point in the history
  • Loading branch information
esther.machata committed Dec 8, 2015
1 parent 9fb980a commit 52fcd18
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/diagrams/flowchart/flowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ exports.addEdges = function (edges, g) {
var edgeText = edge.text.replace(/<br>/g, '\n');
if(typeof edge.style === 'undefined'){
if (conf.htmlLabels){
g.setEdge(edge.start, edge.end,{labelType: 'html',style: style, labelpos:'c', label: '<span style="background:#e8e8e8">'+edge.text+'</span>', arrowheadStyle: 'fill: #333', arrowhead: aHead},cnt);
g.setEdge(edge.start, edge.end,{labelType: 'html',style: style, labelpos:'c', label: '<span class="edgeLabel">'+edge.text+'</span>', arrowheadStyle: 'fill: #333', arrowhead: aHead},cnt);
}else{
g.setEdge(edge.start, edge.end,{labelType: 'text', style: 'stroke: #333; stroke-width: 1.5px;fill:none', labelpos:'c', label: edgeText, arrowheadStyle: 'fill: #333', arrowhead: aHead},cnt);
}
Expand Down
6 changes: 5 additions & 1 deletion src/less/default/flow.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@

.edgePath .path {
stroke: @lineColor;

}

.edgeLabel {
background-color: @edgeLabelBackground;
}

.cluster rect{
fill: @secondBkg !important;
rx:4 !important;
Expand Down
2 changes: 2 additions & 0 deletions src/less/default/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

@titleColor: #333;

@edgeLabelBackground: #e8e8e8;

/* Sequence Diagram variables */
@actorBorder: @border1;
@actorBkg: @mainBkg;
Expand Down
6 changes: 5 additions & 1 deletion src/less/forest/flow.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ color:#333
.edgePath .path {
stroke: @lineColor;
stroke-width: 1.5px;

}

.edgeLabel {
background-color: @edgeLabelBackground;
}

.cluster rect{
fill: @secondBkg !important;
rx:4 !important;
Expand Down
2 changes: 2 additions & 0 deletions src/less/forest/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

@titleColor: #333;

@edgeLabelBackground: #e8e8e8;

/* Sequence Diagram variables */
@actorBorder: @border1;
@actorBkg: @mainBkg;
Expand Down

0 comments on commit 52fcd18

Please sign in to comment.