Skip to content

Instantly share code, notes, and snippets.

@svgeesus
Last active April 30, 2021 18:00
Show Gist options
  • Save svgeesus/2ddd7cf7cf822f2fb2bdc32faeb2b7f6 to your computer and use it in GitHub Desktop.
Save svgeesus/2ddd7cf7cf822f2fb2bdc32faeb2b7f6 to your computer and use it in GitHub Desktop.

CSS Color 5 simple mix in LCH

40% peru, 60% palegoldenrod, in lch

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

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