全屏
<div class="container">
  <div class="swatch">Base Color</div>
  <div class="swatch">+ 30% Black in OKLCH</div>
  <div class="swatch">+ 30% White in OKLCH</div>
</div>
:root {
  --bg: purple;
}

.container {
  display: flex;
  gap: 1rem;
}
.swatch {
  color: white;
  width: 100px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  text-align: center;
  
  &:nth-child(1) {
    background-color: var(--bg);
  }
  &:nth-child(2) {
    background-color: color-mix(in oklch, var(--bg), black 30%)
  }
  &:nth-child(3) {
    background-color: color-mix(in oklch, var(--bg), white 30%)
  }
}

body {
  height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
}
返回