How to control hue interpolation in color spaces
mainWhen interpolating in color spaces that use a hue angle (like lch, hsl, or hwb), you can specify how the hue transition is handled using the hue option. This prevents unexpected color shifts. The available values are:
shorter(default): Takes the shortest path around the hue circle.longer: Takes the long way around the hue circle.increasing: Increases the hue angle.decreasing: Decreases the hue angle.raw: Uses the raw numerical values without circular logic.
let c1 = new Color("rebeccapurple");
let c2 = new Color("lch", [85, 85, 85 + 720]);
c1.range(c2, {space: "lch", hue: "longer"});
c1.range(c2, {space: "lch", hue: "shorter"});
c1.range(c2, {space: "lch", hue: "increasing"});
c1.range(c2, {space: "lch", hue: "decreasing"});
c1.range(c2, {space: "lch", hue: "raw"});