Hi everyone ! I found some code , and i want to modify it , to be able to change the color of two svg rechtangle., but i stucked. If i click on the button , it works well for one rechtangle , but the another became black.
this is the code:[{"id":"8d159deb.79f54","type":"tab","label":"templateFile","disabled":false,"info":"Trying to use a file instead of code int template node."},{"id":"e2611ae2.44df68","type":"function","z":"8d159deb.79f54","name":"nameLabel ColorText ID label","func":"msg.color1 = (msg.payload === \"on\")?\"red\":\"lime\";\nmsg.textColor = \"white\";\nmsg.ID1 = \"svg_1\";\nmsg.nameLabel =\"Text w LED\";\nreturn msg;","outputs":1,"noerr":0,"x":520,"y":140,"wires":[["3e519f6c.09fe"]]},{"id":"848396c9.59b1f8","type":"inject","z":"8d159deb.79f54","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":110,"y":80,"wires":[["ab21bd1a.3c817"]]},{"id":"a351e98b.c35bf8","type":"inject","z":"8d159deb.79f54","name":"","topic":"","payload":"anything else","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":140,"wires":[["20d44052.274d6"]]},{"id":"ab21bd1a.3c817","type":"ui_button","z":"8d159deb.79f54","name":"","group":"91ff15b6.fc5c28","order":0,"width":0,"height":0,"passthru":false,"label":"green","color":"","bgcolor":"","icon":"fa-fire","payload":"asdf","payloadType":"str","topic":"","x":270,"y":80,"wires":[["e2611ae2.44df68"]]},{"id":"20d44052.274d6","type":"ui_button","z":"8d159deb.79f54","name":"","group":"91ff15b6.fc5c28","order":0,"width":0,"height":0,"passthru":false,"label":"red","color":"","bgcolor":"","icon":"fa-fire","payload":"on","payloadType":"str","topic":"","x":270,"y":140,"wires":[["e2611ae2.44df68"]]},{"id":"3e519f6c.09fe","type":"template","z":"8d159deb.79f54","name":"","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"\n<style>\n\n.svg_1 {\n stroke: none;\n fill : {{color1}};\n \n}\n.svg_2{\n stroke: none;\n fill : {{color2}};\n \n}\n\n</style>\n\n<svg width=\"580\" height=\"400\" xmlns=\"http://www.w3.org/2000/svg\">\n <!-- Created with Method Draw - http://github.com/duopixel/Method-Draw/ -->\n <g>\n <title>background</title>\n <rect fill=\"#fff\" id=\"canvas_background\" height=\"402\" width=\"582\" y=\"-1\" x=\"-1\"/>\n <g display=\"none\" overflow=\"visible\" y=\"0\" x=\"0\" height=\"100%\" width=\"100%\" id=\"canvasGrid\">\n <rect fill=\"url(#gridpattern)\" stroke-width=\"0\" y=\"0\" x=\"0\" height=\"100%\" width=\"100%\"/>\n </g>\n </g>\n <g>\n <title>Layer 1</title>\n <rect class =\"svg_1\" id=\"svg_1\" height=\"127\" width=\"147\" y=\"33.4375\" x=\"27.5\" stroke-width=\"1.5\" stroke=\"#000\" />\n <rect class =\"svg_2\" id=\"svg_2\" height=\"152\" width=\"191\" y=\"210.4375\" x=\"330.5\" stroke-width=\"1.5\" stroke=\"#000\" />\n \n </g>\n</svg>","output":"str","x":800,"y":200,"wires":[["bc1ac945.821798"]]},{"id":"bc1ac945.821798","type":"ui_template","z":"8d159deb.79f54","group":"91ff15b6.fc5c28","name":"","order":0,"width":"15","height":"10","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":960,"y":200,"wires":[[]]},{"id":"331cec3d.cc0714","type":"inject","z":"8d159deb.79f54","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":110,"y":280,"wires":[["d609d141.8f274"]]},{"id":"45a79ebd.aaed3","type":"inject","z":"8d159deb.79f54","name":"","topic":"","payload":"anything else","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":340,"wires":[["18e32917.817ae7"]]},{"id":"d609d141.8f274","type":"ui_button","z":"8d159deb.79f54","name":"","group":"91ff15b6.fc5c28","order":0,"width":0,"height":0,"passthru":false,"label":"green","color":"","bgcolor":"","icon":"fa-fire","payload":"asdf","payloadType":"str","topic":"","x":270,"y":280,"wires":[["9ed544a0.e0e1b8"]]},{"id":"18e32917.817ae7","type":"ui_button","z":"8d159deb.79f54","name":"","group":"91ff15b6.fc5c28","order":0,"width":0,"height":0,"passthru":false,"label":"red","color":"","bgcolor":"","icon":"fa-fire","payload":"on","payloadType":"str","topic":"","x":270,"y":340,"wires":[["9ed544a0.e0e1b8"]]},{"id":"9ed544a0.e0e1b8","type":"function","z":"8d159deb.79f54","name":"nameLabel ColorText ID label","func":"msg.color2 = (msg.payload === \"on\")?\"red\":\"lime\";\nmsg.textColor = \"white\";\nmsg.ID2 = \"svg_2\";\n\nreturn msg;","outputs":1,"noerr":0,"x":520,"y":260,"wires":[["3e519f6c.09fe"]]},{"id":"91ff15b6.fc5c28","type":"ui_group","z":"","name":"Default","tab":"28de6aa.bc23196","disp":true,"width":"15","collapse":false},{"id":"28de6aa.bc23196","type":"ui_tab","z":"","name":"tests","icon":"dashboard"}]