Skip to content

Instantly share code, notes, and snippets.

@svgeesus
Last active August 13, 2021 14:25
Show Gist options
  • Save svgeesus/da8e436b87f61c2f9364ce1c2be89eac to your computer and use it in GitHub Desktop.
Save svgeesus/da8e436b87f61c2f9364ce1c2be89eac to your computer and use it in GitHub Desktop.

color-mix tester

Also displays the intermediate results

let fromColor = new Color("red");
let toColor = new Color("green");
let p = 0.5;
let space="lch";
let fromInSpace = fromColor.to(space);
let toInSpace = toColor.to(space);
let mix= fromColor.range(toColor, {
    space: space, // interpolation space
    outputSpace: space
});
mix(p);
mix(p).to("srgb").toString({"format":255});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment