Evercoder / Evercoder/culori

Interpolator throwing a NaN/undefined

Open
#202 4 comments 1 reaction 1 assignee Claimed by @danburzo View on GitHub
Bug
Dominant language
JavaScript
Stars
1.2k
Forks
38
PR merge metrics
No merged PRs in 30d

Description

Hey there,

First off, thank you for a wonderful library.
I encountered a bug when trying to interpolate two colors in Lch and okLch space. Everything works fine, except when an interpolated color is black or white and there are more than two colors to interpolate over.

In the example below, I've got 3 colors in the initial color array and something breaks. However, if I delete one of them and start just with two everything works fine.

If I inspect one of the missing colors I notice the CSS property: background: lch(73.90988017397126 107.41130153548478 **NaN**)
The NaN is probably generating the problem.

Code here: https://codesandbox.io/s/lch-interpolator-wt5yk5?file=/App.svelte

Also, if I put just black and white as starting colors I get background: lch(100.00000139649632 0 **undefined**) for white and lch(0 0 **undefined**) for black.

Does this happen because black and white being achromatic colors are missing the **h** attribute?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.