kelvin-to-rgb
v1.0.2
Published
approximate an RGB color from a Kelvin temperature
Downloads
1,232
Maintainers
Readme
kelvin-to-rgb
Approximate an [r, g, b]
color from a Kelvin temperature between 1,500 and 40,000.
Details and original implementation by Tanner Helland, see here.
Example
var kelvinToRgb = require('kelvin-to-rgb')
var K = 1600
// get [ r, g, b ] color
var rgb = kelvinToRgb(K)
Install
npm install kelvin-to-rgb --save
Usage
rgb = kelvinToRGB(kelvin, [out])
Approximates the color temperature for the given kelvin
value (should be between 1500 - 40000). Returns a new array, [r, g, b]
with bytes in 0 - 255 range.
If out
is specified and it is an array, it will be used instead of creating a new array (this is useful to avoid GC thrashing).
License
MIT, see LICENSE.md for details.