Qix-/color





The issue has been closed
Color conversion results in NaNs #195
lukeocodes posted onGitHub
Thanks for this library folks! I just found that there appears to be a division by zero error. A NaN can appear in the RGB array from a simple zero in the pallet. Searching past issues and all mentions of this appeared to be fixed before?
const color = Color("#0000ff");
console.log(
color,
color.whiten(),
color.lighten()
);
The results:
color:
Color {model: "rgb", color: Array(3), valpha: 1}
color: (3) [0, 0, 255]
model: "rgb"
valpha: 1
__proto__: Object
color.whiten():
Color {model: "hwb", color: Array(3), valpha: 1}
color: (3) [240, NaN, 0]
model: "hwb"
valpha: 1
__proto__: Object
color.lighten():
Color {model: "hsl", color: Array(3), valpha: 1}
color: (3) [240, 100, NaN]
model: "hsl"
valpha: 1
__proto__: Object