How to change the colour of all the nodes on diagram click

When I am selecting a node i am changing the colour of the nodes which are connected from(green) and to(red) to the selected node, the default colour of all nodes on diagram load is blue, I am trying to change all the node colour to default if user clicks on empty space of the diagram.

is there a way to fill all node colour on mydiagram click ?

How did you change the colors of those nodes to red? I would expect you could use the same technique.

Hi Walter,

On node click i am calling node.findNodesOutOf and node.findNodessInto to change the color, but here i am getting node object coz the click call is inside nodeTemplate, Not sure how to get the node object on myDiagram click so that i can the color of all nodes back to default.

Well, the user might have clicked multiple nodes, causing many unrelated-to-each-other nodes to have been turned red.

So you might as well just run through all of the Diagram.nodes.

It worked, thanks, applied the Diagram.nodes.each and changing the color of node back to default.