Skip to content

Instantly share code, notes, and snippets.

@svgeesus
Last active November 23, 2021 19:17
Show Gist options
  • Save svgeesus/a15d30c8276465d1dfe5ec7b918a3a4b to your computer and use it in GitHub Desktop.
Save svgeesus/a15d30c8276465d1dfe5ec7b918a3a4b to your computer and use it in GitHub Desktop.

color-mix() examples for tests

let fromCol = new Color("color(display-p3 1 0 0)");
let toCol = new Color("green");
let mix= fromCol.range(toCol, {
    space: "oklab", // interpolation space
    outputSpace: "srgb"
});
let expected = mix(.9); // amount of toCol
expected.toString(
{precision:6, commas: "true", format: 255})

let purple = new Color("lch(51.51% 52.21 325.8 / 0.6) ");
purple.to("srgb").toString(
{precision:6, commas: "true", format: 255})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment