Take a look at these 2 threads. They might help. If I understand what you are trying to do, you want a value of temperature that ranges from X to Y to change the color value of a RGB bulb from A to B. In the 2nd thread, @adamkempenich's app changes a dimmer value of a virtual dimmer to a Color Temperature of a CT bulb and you are trying to convert a temperature value to a RGB Color. If you are also trying to incorporate Hue & Saturation, that gets complicated. Take a look, his app might be helpful.
Any chance you are using Node Red on a Raspberry Pi (or similar) in combination with Hubitat? If you were, then a relatively simple flow could do that for you.