Skip to content

Instantly share code, notes, and snippets.

@paulkaplan
paulkaplan / colorTempToRGB.js
Last active January 30, 2025 14:32
Color Temperature to RGB
// From http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
// Start with a temperature, in Kelvin, somewhere between 1000 and 40000. (Other values may work,
// but I can't make any promises about the quality of the algorithm's estimates above 40000 K.)
function colorTemperatureToRGB(kelvin){
var temp = kelvin / 100;