Skip to content

Color Temperature

Kelvin temperature describes the color appearance of light sources from warm (orange) to cool (blue).

Creating Kelvin Colors

zig
const tint = @import("tint");

// Warm light (candle, incandescent)
const warm = tint.kelvin(2700);

// Daylight
const daylight = tint.kelvin(6500);

// Cool blue sky
const cool = tint.kelvin(10000);

Common Temperatures

KelvinDescription
1000KCandle light
2000KWarm white
2700KIncandescent
3000KHalogen
4000KFluorescent
5000KDirect sunlight
6500KCloudy daylight
8000KLight blue sky
10000KBlue sky
20000KDeep blue sky

Temperature to RGB

zig
const rgb = tint.Color.temperatureToRgb(6500);
std.debug.print("RGB: ({d},{d},{d})\n", .{ rgb.r, rgb.g, rgb.b });

Running

bash
zig build run-color_temperature

Source

See examples/color_temperature.zig for the complete example.

Released under the MIT License.