Skip to content

Instantly share code, notes, and snippets.

@svgeesus
Last active April 3, 2021 22:51
Show Gist options
  • Save svgeesus/715b15e1c0a8d51ba37e26b82b494505 to your computer and use it in GitHub Desktop.
Save svgeesus/715b15e1c0a8d51ba37e26b82b494505 to your computer and use it in GitHub Desktop.

Linear-light interpolation

// XYZ and linear-light sRGB gives same result
let c1 = new Color("rebeccapurple");
let c2 = new Color("lch", [85, 100, 85]);
c1.range(c2); // lab
c1.range(c2, {space: "srgb"}); // gamma encoded sRGB
c1.range(c2, {space: "srgb-linear"}); //linear-light sRGB
c1.range(c2, {space: "xyz"}); // XYZ, same result as linear RGB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment