// kelvin values are around 270-290 normally for room temperature // we have to scale up those, so we multiply by 10 public Color KelvinToGrayscaleColor(int kelvin) { kelvin *= 10; var min = 2200; var max = 3800; var highestBit = 255; var result = 0.0; if (item <= max && item >= min) { result = ((double)(highestBit) / ((double)(max - min))) * ((double)(item - min)); } return new Color(result, result, result) }