A similar question was answered recently, maybe you’ll find a solution there: How to add color to BPMN diagram for dynamic XML
Colors in BPMN are handled via bioc:fill
and bioc:stroke
properties in the di information. The cleanest way is to populate those information dependent on state to the XML before importing it to the renderer so it can render it accordingly.