gka / chroma.js

JavaScript library for all kinds of color manipulations
https://gka.github.io/chroma.js/
Other
10.08k stars 543 forks source link

chroma.temperature generates a NaN for values under 200 #255

Closed terrarum closed 2 years ago

terrarum commented 3 years ago

Calling chroma.temperature() with values under 200 returns a Color object with the following:

_rgb: (4) […]
  0: 255
  1: NaN
  2: 0
  3: 1

You can see this failing in the documentation if you set the values to 199 or lower: https://gka.github.io/chroma.js/#chroma-temperature

Artoria2e5 commented 3 years ago

I can see how that's happening with a log(g) in temperature2rgb.js, and basic math dictates you just can't do that with a negative g. PR sent.