How to create a color gradient for RGB bulbs

Hi,

I'm looking for a method to go from one hex color to another in a gradient.
I found this wonderful website which gives me an array of hex codes. That all together create a gradient from one color to the other. The end goal is to send this to my RGB bulbs.
Is there a node that just does this? Or do I need to program this somehow in a function node ?


I'm going to replay on my own question because I pulled something very basic together. Still wondering if there is a better way to accomplish this.

[{"id":"74bf0bd5.d64774","type":"tab","label":"Color Gradient (development)","disabled":false,"info":""},{"id":"7cf5bfb4.18927","type":"function","z":"74bf0bd5.d64774","name":"select hex","func":"//color array\nvar gradient = ['FFF9E5', 'FFF4CC', 'FFEFB2','FFEA99', 'FFE47F','FFDF66','FFDA4C','FFDA4C','FFDA4C','FFD533','FFCF19','FFCA00'];\nvar max_index = 11;\n//counter\nvar count = context.get('count')||0;\nif (count == max_index){\n  count = 0;\n}else{\n  count += 1;  \n}\n// store the value back\ncontext.set('count',count);\n//output and store hex value\nvar hex = gradient[count];\ncontext.set(\"hue\", \"#\"+hex);\nmsg.payload = {\"color\": {\"hex\":\"#\"+hex},\"transition\": 1};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620,"y":300,"wires":[["d80870e4.736ed"]]},{"id":"da902d7e.b5479","type":"inject","z":"74bf0bd5.d64774","name":"","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":"3","topic":"","payload":"","payloadType":"date","x":190,"y":300,"wires":[["7cf5bfb4.18927"]]},{"id":"d80870e4.736ed","type":"mqtt out","z":"74bf0bd5.d64774","name":"","topic":"zigbee2mqtt/ikea_rbg_1/set","qos":"","retain":"","broker":"6fb7644f.31a0bc","x":1040,"y":300,"wires":[]},{"id":"6fb7644f.31a0bc","type":"mqtt-broker","name":"","broker":"mosquitto","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"zigbee2mqtt/bridge/log","birthQos":"0","birthPayload":"zigbee2mqtt","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.