A more general approach (i.e. if you want one specific color for all sequence flows) would be to change the color in the BpmnRenderer. One way to do this is to add the stroke attribute for the desired elements (in this case all sequence flows) here:
In my case, colored connections became black immediately after any action. Then, i’ve found another solution:
var a = bpmnRenderer.drawConnection;
var fixConnectionColor = function(visuals, connection){
var res = a.call(bpmnRenderer,visuals, connection);
var color = 'black';
if(Math.random()<.5){
color = 'green';
}
visuals.select('path').attr({stroke: color});
return res;
}
bpmnRenderer.drawConnection = fixConnectionColor;
I get the error below after using the setColor(), and when I am getting the xml of the diagram using saveXML()…
Any Idea what could be the issue? But the color on the connector is set correctly.
missing namespace information for di = Object on ModdleElement Error: no namespace uri given for prefix
at ElementSerializer.logNamespaceUsed (writer.js:468)
at ElementSerializer.nsAttributeName (writer.js:254)
at writer.js:348
at arrayEach (arrayEach.js:15)
at createForEach.js:15
at ElementSerializer.parseGenericAttributes (writer.js:339)
at ElementSerializer.build (writer.js:210)
at writer.js:405
at arrayEach (arrayEach.js:15)
at createForEach.js:15
I have applied the patches related to that…that makes it possible to save the color on connector… and also the getXML has that color set and loading again works… but still I have that in the console the error message when the setColor is invoked?