Hello everyone,
I am currently working on replicating Scratch-style blocks using Blockly. In Scratch blocks, there are FieldLabelSerializable Fields with different backgrounds. How should I approach this programmatically?

I have already asked Gemini to generate some preliminary code, but the actual operation does not produce the correct visual output. I would be grateful for everyone's help to complete this project as soon as possible.
block.appendDummyInput()
.appendField(new FieldLabelHexagon("AAA");
```
class FieldLabelHexagon extends Blockly.FieldLabelSerializable {
static KEY_ = 'field_label_hexagon';
constructor(opt_value, opt_class, opt_config) {
super(opt_value, opt_class, opt_config);
this.SERIALIZABLE = true;
this.borderRectPadding_ = {
top: 0,
right: 12,
bottom: 0,
left: 12
};
}
initView() {
super.initView();
if (this.fieldBorderRect_) {
this.fieldBorderRect_.remove();
}
this.fieldBorderRect_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.Svg.PATH,
{
'fill': this.sourceBlock_ ? this.sourceBlock_.getColour() : '#999999',
'stroke': this.sourceBlock_ ? this.sourceBlock_.getColour() : '#999999',
'class': 'blocklyFieldRect blocklyFieldLabelHexagonPath'
},
this.fieldGroup_
);
this.textElement_.style.fill = 'black';
}
updateSize_() {
super.updateSize_();
if (!this.fieldBorderRect_) {
return;
}
const width = this.size_.width;
const height = this.size_.height;
const h = 10;
const path =
`M 0 ${height / 2} ` +
`L ${h} 0 ` +
`L ${width - h} 0 ` +
`L ${width} ${height / 2} ` +
`L ${width - h} ${height} ` +
`L ${h} ${height} ` +
`Z`;
this.fieldBorderRect_.setAttribute('d', path);
}
}
Blockly.FieldLabelHexagon = FieldLabelHexagon;
Blockly.registry.register(
Blockly.registry.Type.FIELD,
FieldLabelHexagon.KEY_,
FieldLabelHexagon
);
```
Thank you all for your assistance.
fu6...