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.average wrong computation #282

Open marcelpi opened 2 years ago

marcelpi commented 2 years ago

Hi,

I was just trying to average the red, green, blue primaries using chroma.average and I was expecting the result to be [120, 1, 1]. Instead I got [116.57, 1, 1].

Red hue = 0 Green hue = 120 Blue hue = 240

So, I was expecting the average hue to be (0 + 120 + 240) / 3 = 360 / 3 = 120.

Am I missing something here?

Screen Shot 2021-10-27 at 23 27 05 Screen Shot 2021-11-01 at 20 08 29