Skip to content

Interpolator throwing a NaN/undefined #202

Description

@marcelpi

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions