Skip to content

Instantly share code, notes, and snippets.

@svgeesus
Created April 30, 2021 18:14
Show Gist options
  • Save svgeesus/2fb07e0a4eef97b0d0a1950f94ab3951 to your computer and use it in GitHub Desktop.
Save svgeesus/2fb07e0a4eef97b0d0a1950f94ab3951 to your computer and use it in GitHub Desktop.

CSS Color 5 simple mix in LCH

65% teal, 35% olive, in lch

For https://drafts.csswg.org/css-color-5/#color-mix

let color = new Color("teal");
color.to("lch").toString({precision:6});
let color2 = new Color("olive");
color2.to("lch").toString({precision:6});
let mix= color.range(color2, {
    space: "lch", // interpolation space
    outputSpace: "srgb"
});
let blend = mix(.65); // 65% teal
blend.to("lch").toString({precision:6});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment