How to change the color of external labels in addMarker?

Add colors via CSS styling Cannot change the color of external labels。

1722930144194
1722930179660
The effect I want is that the text outside the process line can also change color

The current solution I can think of is to make changes through HTML elements. Is there any other better way to implement it

const parentElement = document.querySelector("[data-element-id=" + element.id + "_label");
if (parentElement) {
  const labelElement = parentElement.querySelector('.djs-label');
  labelElement.style.fill = 'green';
}

I propose you add a marker to both the element and the elements label:

const element = canvas.getElement('myConnection');

const label = element.label;

if (label) {
  canvas.addMarker(label, 'greenColor');
}

You should then be able to color both element and label via the marker CSS class greenColor.

Thank you, I will try it out according to the method you provided first. If there are any problems, I will consult you. Thank you again!!

canvas.getElement is not a function

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.