function kelvinToRGB(kelvin) {
  const temperature = kelvin / 100;
  let red;
  let green;
  let blue;

  // Calculate Red
  if (temperature <= 66) {
    red = 255;
  } else {
    red = temperature - 60;
    red = 329.698727446 * red ** -0.1332047592;
    if (red > 255) {
      red = 255;
    }
  }

  // Calculate Green
  if (temperature <= 66) {
    green = temperature;
    green = 99.4708025861 * Math.log(green) - 161.1195681661;
    if (green < 0) {
      green = 0;
    }
    if (green > 255) {
      green = 255;
    }
  } else {
    green = temperature - 60;
    green = 288.1221695283 * green ** -0.0755148492;
  }

  // Calculate Blue
  if (temperature >= 66) {
    blue = 255;
  } else if (temperature <= 19) {
    blue = 0;
  } else {
    blue = temperature - 10;
    blue = 138.5177312231 * Math.log(blue) - 305.0447927307;
    if (blue < 0) {
      blue = 0;
    }
  }

  return [Math.round(red), Math.round(green), Math.round(blue)];
}
@description Convert Kelvin to RGB temp color.
@param {number} kelvin - Color temperature in Kelvin.
@returns {Array} - Return array of RGB.
@example const [r, g, b] = kelvinToRGB(2500);