<div class="swatch"></div>
<div class="swatch"></div>
<div class="swatch primary"></div>
<div class="swatch"></div>
<div class="swatch"></div>
@layer demo {
:root {
--base-color: deeppink; /* change me */
}
.swatch:nth-child(1) {
background: oklch(from var(--base-color) calc(l - 20) c h);
}
.swatch:nth-child(2) {
background: oklch(from var(--base-color) calc(l - 10) c h);
}
.swatch.primary {
background: var(--base-color);
}
.swatch:nth-child(4) {
background: oklch(from var(--base-color) calc(l + 10) c h);
}
.swatch:nth-child(5) {
background: oklch(from var(--base-color) calc(l + 20) c h);
}
}
@layer demo.support {
* {
box-sizing: border-box;
margin: 0;
}
html {
block-size: 100%;
color-scheme: dark light;
}
body {
min-block-size: 100%;
font-family: system-ui, sans-serif;
display: grid;
grid-template-rows: repeat(5, 1fr);
}
}
This Pen doesn't use any external JavaScript resources.