Hello, how to dynamically modify the label color of elements

image
I would like to modify the font color of the label. Is there an API or other methods that can be used

You want to modify just the label? Not the shape border too?

You may not understand what I mean, as shown in the picture. I want to dynamically modify the text font (9999) color of the Task element,
image

A flowchart is essentially SVG, and you can just modify the tag attributes, like this:

const userTask = elementRegistry.get('your user task');
const label = userTask.label
label.attr('fill', 'color');
console.info(userTask.label)
undefined

不行,是因为我的bpmn.js版本(11.2.0)问题嘛

Not all types have labels. If you want to change the label of a given node, you can first define the label and add the class when the node is created, and then modify it by setting the css style

There is an API to change an element’s color (Modeling#setColor), however, this API does not allow you to set the stroke color of the task and the color of the label independently. CSS or a custom renderer would be your options.