I'm missing something with the inject node and the { } optoin

Some of this could be avoided if the red box did not show up on initial display of a new node with an empty JSON string…

Ok, thanks. I didn’t realise the border colour was significant…

msg.background isn’t being set, msg.payload.background is.

Message. You pass Messages between nodes. Not Package. Message.

The Inject node in the flow you've shared is setting msg.payload to the value {"payload":"","background":"red"}

That means msg.payload has that whole value. It is not setting msg.payload and msg.background.

The Inject node can only set msg.payload and msg.topic. I've said that twice already and I really cannot make that any clearer. It can only set those two properties.

If you want to set msg.background you need to use a Change node. You cannot do that with just an Inject node.

Here is a flow with the Change node added to set msg.background.

[{"id":"9124b7ee.b1e3d8","type":"ui_button","z":"1afd08.80e012f8","name":"","group":"77481625.d282a8","order":0,"width":0,"height":0,"passthru":false,"label":"button","color":"","bgcolor":"","icon":"","payload":"{\"payload\":\"\",\"background\":\"red\"}","payloadType":"json","topic":"","x":210,"y":260,"wires":[["92b1160e.cd2f58"]]},{"id":"92b1160e.cd2f58","type":"ui_button","z":"1afd08.80e012f8","name":"","group":"7f2f9e09.f95f5","order":0,"width":0,"height":0,"passthru":true,"label":"victim","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"str","topic":"","x":590,"y":260,"wires":[["9b20671e.080c38"]]},{"id":"74e738da.4d6a08","type":"inject","z":"1afd08.80e012f8","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":180,"wires":[["bc5ff804.f184e8","5208f931.e3ab98"]]},{"id":"bc5ff804.f184e8","type":"debug","z":"1afd08.80e012f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":420,"y":180,"wires":[]},{"id":"9b20671e.080c38","type":"debug","z":"1afd08.80e012f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":710,"y":260,"wires":[]},{"id":"5208f931.e3ab98","type":"change","z":"1afd08.80e012f8","name":"","rules":[{"t":"set","p":"background","pt":"msg","to":"red","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":220,"wires":[["92b1160e.cd2f58"]]},{"id":"77481625.d282a8","type":"ui_group","name":"Group 1","tab":"f8e4161b.b12b68","order":1,"disp":true,"width":6},{"id":"7f2f9e09.f95f5","type":"ui_group","name":"Group 2","tab":"f8e4161b.b12b68","order":2,"disp":true,"width":6},{"id":"f8e4161b.b12b68","type":"ui_tab","z":"","name":"Colour test","icon":"dashboard","order":5}]```

Um, ok.

But I’m easily confused.

Though knollearly has told me (time and again) that the INJECT node can’t do it and I should have listened - and it isn’t to have any disrespect for what he says - your reply was taken as:
“Oh, you can do what you ORIGINALLY ASKED by doing this…”

And so I STUPIDLY believed that what you posted would set msg.background to “red”.

Yes, it was/is written in the code - had I actually read it - but how you replied threw me for believing that what you posted fitted my original request.

I really have to learn to read. but sorry, your reply didn’t help my confusion.

I think you need to read up on objects. They can be quite hard to get your head around, but once things become clear, it’s not as obtuse.

msg is an object, think of a car object:

it has values (car.wheels:4, car.transmision:automatic, car.colour:red) and it has methods (functions) that do things (update a property value or run code)