Kelvin 1.0.0

Kelvin turns a colour temperature into an sRGB colour you can paint on a screen. Pass in 2700 and you get back r 255, g 167, b 87, or #ffa757, which is close to the colour of a warm household bulb. It ships ESM and CommonJS builds with TypeScript types and has no dependencies. The maths is Tanner Helland's 2012 blackbody approximation, credited in the README. Inputs are clamped to 1000 K through 40000 K, the range his fitted curves were made for. It is meant for UI work such as a preview swatch or a colour temperature slider. It is not colorimetry and ignores the display's white point and gamma. Made by the team behind Sundown for Mac (https://trysundown.com). Source code and tests: https://bitbucket.org/trysundown/kelvin

Tags javascript library color kelvin rgb
License MITL
State stable

Recent Releases

1.0.002 Oct 2026 22:39 major feature: First public release. kelvinToRgb and kelvinToHex, MIN_KELVIN and MAX_KELVIN exports, ESM and CommonJS builds, TypeScript types, and 11 tests on the built-in Node test runner.