A python library for converting colour temperature (Kelvin) to RGB values
Convert color from RGB to Kelvin and back
pip install kelvin_rgb
import kelvin_rgb
r, g, b = kelvin_rgb.k_to_rgb(3500)
print(r,g,b) #outputs (255, 138, 195)
hex = kelvin_rgb.k_to_rgb_hex(3500)
print(hex) #outputs '#ff8ac3'
Note: The conversions use approximations and are suitable for photo-manipulation and other non-critical uses.
Accuracy is best between 1000K and 40000K.