Temperature/Color conversion library

I'm working on a lighting project using RGB LEDs and I didn't have a stripped down, basic function to generate natural/blackbody light colors. I wrote an arduino library that takes input of a temperature and brightness and produces the corresponding 24-bit color code for a ws2812 LED. You can send temperature as an integer from 1000 to 40000 Kelvin (6600K is ~ plain white) or a float from -1 (cold) to 1 (hot) and brightness as an integer (0-255) or float (0.0-1.0). Remember, counterintuitively, red is cold/low and blue is hot/high because it's radiation, not photography.

https://gitlab.com/tllado/tempcolor

Comments