jaames / iro.js

🎨 Modular color picker widget for JavaScript, with support for a bunch of color formats

Home Page:https://iro.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sliderType kelvin values not accurate

DenFin opened this issue · comments

Hi @jaames,

first of all I want to give you some positive feedback. It's a great library, easy to use, good documentation (!) and really nice demo sit/docs site.

We faced an issue with the kelvin slider. When I drag the slider completely to the left or right the values are never the min oder max values. For example if I drag the slider completely to the left I would expect the value to be 2200, but it actually goes lower, something like 2193.9544677734375. When I drag the slider completely to the right I would expect the value to be 11000, but it is actually something like 10991.775512695312.

I created an example on Stackblitz.

commented

thanks for the kind words :)

the discrepancy you're seeing is because iro.js colors are stored as hsv values internally (since it was originally only a hsv color picker) - unfortunately converting a kelvin temperature to hsv and back again isn't super precise and some precision is lost along the way

@jaames thanks for your fast reply!

i see. we'll try to fix the problem on our side.