Created
March 27, 2021 23:21
-
-
Save LeaVerou/e541e1b1e21c0c8e740924af9646fe0c to your computer and use it in GitHub Desktop.
LCH vs HSL colors for the same lightness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="hsl"></div> | |
<div class="lch"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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