Updating Node's Background Color depending on config

I'm trying to change the background color (.color property) of a custom node when the user links it via editor to another node so my node 'inherits' the linked node's color.
This could be extended to changing node's background color for whatever other reason, options chosen in the node's configuration, number of outputs...
However, when I try to set this.color or this._def.color in the oneditsave, there's no visual effect in the dashboard, the change to color property is ignored even when it's added to the defaults (something that works for # of outputs for example).
How can this be achieved? How can someone change node's color using node editor?

The colour is not meant to be changeable. Flows are meant to be easy to "read" by looking at them. Part of that readability is consistency of colour, so that you can recognise what a node is by its colour.

Rather than using the node colour, use the status msg. That should give you a decent indication.

In my case, I need to change the background color exactly for consistency reasons!
Here's the reason:

  1. I have several node types that act as sources of information, each type using different color
  2. A target node allow to subscribe to one of the sources for processing (I can't use link nodes for that, - the reasoning is beyond the scope of this request/question) - Once a source is chosen, I want the target node to "take" the color of the source so that I can visually see what source it links to.

Note that the change doesn't happen at run-time but only at design time - exiting from the node editor should allow to set the color of the node in my opinion, it would be beneficial not just in my case.

Regardless of the general merits, the fact remains that in the code today, it is not possible to change the colour of a node via its configuration.

why not use one colour for all your nodes so they are all easily spotted, then different icons for the different types... ?

1 Like

I think his point is that he has multiple different input nodes but only a single output node and he wants the output node to change its color to match the input node.

Workaround: Change the icon manually for the output node to match the input node

1 Like

Personally I've never seen a need for that but then my use cases are certainly limited.

Of course, you could always hack it.

All of the nodes are just defined in text so you could use a script to manipulate them. Of course, you'd have to redo it whenever one of the nodes was updated - but still. I'm not recommending that though, only mentioning it in case you feel strongly enough that the outcome warrants the hack.

Nope, hacking the flow definition file makes no sense if it has to be redone each time...
If anything, I was hoping to hack the objects already loaded into the node at run-time, but was unable to override any of the color properties successfully (with a visual effect).

I'll try the suggested change of the Icon instead of the background color, although I'm using an arrow to indicate an input node so changing it to something meaningful yet distinct for each type will be a challenge :frowning:

Is there any chance for this feature to be implemented in some near-future version? I can help with that as I had to get myself quite familiar with some of the NR code lately anyway...

Sorry - but for the reasons already cited we do not want to enable this. Certainly not in any short term plans.