Change the element's fill color and outline color, using the element ID of the SVG graphic opened in the SVG element.
void @SVGElementColor(string classname, string elementID, int color, int flagFill, flagStroke);
Parameters
string classname : The class name of the SVG object
string elementID : SVG element ID
int color : RGB color value
int flagFill : whether the fill color has changed or not
int flagStroke : whether the outline color changes or not
Return value
None.
Example1)
If($DI_0000 == 1)
@SVGElementColor("SVG1", "Circle1", @RGB(255,0,0), 1, 1);
else
@SVGElementColor("SVG1", "Circle1", @RGB(0,0,255), 1, 1);
Description :
If the DI_0000 tag is 1, the SVG graphic of the SVG1 object changes both the
fill color and the outline of the element with ID Circle1 to red.
If the
DI_0000 tag is 0, change both the fill color and outline of the element with ID
Circle1 in the SVG graphic of the SVG1 object to blue.
Example2)
@SVGElementColor("SVG1", "Path1", @RGB(0,0,255), 1, 0);
Description : In the SVG graphic of the SVG1 object, change the fill color of the element with ID path1 to blue. (Keep the outline the same.)
Note) If the SVG file does not have an element ID, you can open the SVG file with an editor such as Notepad and specify the ID as shown below.
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="200" viewBox="0 0
300 200">
<rect id="bg" width="100%"
height="100%" fill="#f0f0f0"/>
<text id="main-title"
x="150" y="50" font-family="Arial, sans-serif" font-size="24"
text-anchor="middle" fill="#333333">Main title</text>
<circle
id="circle" cx="150" cy="120" r="20" fill="#3498db"/>
<rect
id="rect" x="145" y="90" width="10" height="10"
fill="#121212"/>
<path id="curve1" d="M60,140
C90,110 120,170 150,140 S210,110 240,140" stroke="#4285f4" stroke-width="3"
fill="none"/>
</svg>
Version Information
Supported Version: 10.3.6.21
Related Helps)