Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Created March 27, 2021 23:21
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 LeaVerou/e541e1b1e21c0c8e740924af9646fe0c to your computer and use it in GitHub Desktop.
Save LeaVerou/e541e1b1e21c0c8e740924af9646fe0c to your computer and use it in GitHub Desktop.
LCH vs HSL colors for the same lightness
/**
* LCH vs HSL colors for the same lightness
*/
div {
width: 100%;
height: 6em;
background: linear-gradient(to right, var(--stops));
--stops: gray, gray;
--l: 50%;
}
.hsl {
--s: 100%;
--stops: hsl(0 var(--s) var(--l)),
hsl(60 var(--s) var(--l)),
hsl(120 var(--s) var(--l)),
hsl(180 var(--s) var(--l)),
hsl(240 var(--s) var(--l)),
hsl(300 var(--s) var(--l));
}
.lch {
--c: 100;
--stops: lch(var(--l) var(--c) 0),
lch(var(--l) var(--c) 60),
lch(var(--l) var(--c) 120),
lch(var(--l) var(--c) 180),
lch(var(--l) var(--c) 240),
lch(var(--l) var(--c) 300);
}
<div class="hsl"></div>
<div class="lch"></div>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment