kelvin-to-rgb

1.0.2 • Public • Published

kelvin-to-rgb

stable

demo

(demo) - (source)

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

NPM

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.

/kelvin-to-rgb/

    Package Sidebar

    Install

    npm i kelvin-to-rgb

    Weekly Downloads

    430

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • mattdesl