Change element attributes on bpmn-js - bpmn-viewer v0.20.5


I’m having trouble setting attributes - like the stroke color - for a BPMNEdge and/or BPMNLabel canvas element. Is this functionality available within v.020.5? If so, could you give me an example?

Kind regards, Giovanni


Have a look at the tests for setting colors in order to see how it’s done.

The basic syntax is:

modeling.setColor(myShape, { fill: 'red', stroke: 'blue' });


Hello philippfromme,

I tried this with viewer but didn’t work, so I used overlays it works fine but i need to color the border of a task, this modeling.setColor would work nice but i’m in viewer mode, do you have any tip?


There’s not modeling API in the viewer since it’s not a modeler.

Closing this for now. Please do not necrobump topics. Open new ones instead.