Skip to content

Instantly share code, notes, and snippets.

@faceless2
Created February 26, 2021 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faceless2/1af496ed83b559ca777185c0b6ad0ad7 to your computer and use it in GitHub Desktop.
Save faceless2/1af496ed83b559ca777185c0b6ad0ad7 to your computer and use it in GitHub Desktop.
LCH gradient demo
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
.outer {
display:inline-block;
}
.outer div {
width: 100px;
height: 50px;
}
#div1 {
background: lch(75% 67 180deg);
}
#div2 {
background: linear-gradient(lch(75% 67 180deg), lch(75% 101 82deg));
}
#div2-srgb {
/* Same values as div2 but clipped to sRGB gamut - math from https://css.land/lch/ */
background: linear-gradient(rgb(0% 81.73% 71.63%), rgb(89.44% 68.9% 0%));
}
#div3 {
background: lch(75% 101 82deg);
}
</style>
</head>
<body>
<div class="outer">
<div id="div1"></div>
<div id="div2"></div>
<div id="div3"></div>
</div>
<div class="outer">
<div id="div1"></div>
<div id="div2-srgb"></div>
<div id="div3"></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment