Opacity rectangle Svg node

I'm trying to change the transparacy of an Svg rectangle element in the svg node from Bart, but can't get it working.
Tried almost every combination fill-opacity with underscore or with dash, the attribute value as string or int. But it will not work, nothing changes regarding the opacity.
Rest of the payload is working fine.

msg.payload = [
    {
        "command": "update_style",
        "selector": "#rect_2509",
        "attributeName": "fill",
        "attributeValue": achtergrondkleur
    },
     {
        "command": "set_attribute",
        "selector": "#rect_2509",
        "attributeName": "fill-opacity",
        "attributeValue": "10"
    },
    {
        "command": "update_text",
        "selector": "#txt_2509",
        "textContent": pcOnline
    }
]

If you are trying to hide it ?

you could try -
{
"command": "set_attribute",
"selector": "#rect_2509",
"attributeName": "visibility",
"attributeValue": "hidden"

}

1 Like

it is very possible you are doing it right but the property is not affected due to svg fill inheritance. For example, have you set the fill="currentColor" attribute?

if you inspect the SVG and edit the attributes directly in the HTML do you see the changes you expect?

1 Like

Got it,
You need to set in the Svg editor the style location of the rectangle to attribute. Default it's inline.

Also the attribute opacity value is between 0 and 1, not 0 to 100 as I googled in the first place.

Thanks for the help

1 Like

I use Inkscape on my PC as I find it much easier to work with. You can just copy / paste between the two.

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