<h1>Triadic Colors</h1>
<div class="container">
<div class="box box01">Triadic 1</div>
<div class="box box02">Triadic 2</div>
<div class="box box03">Triadic 3</div>
</div>
* {
box-sizing: border-box;
}
:root {
/* font settings */
font-family: system-ui, sans-serif;
font-size: 1.2rem;
/* Base Color Settings */
--triadic1: #663399;
--triadic2: oklch(from var(--triadic1) l c calc(h + 120));
--triadic3: oklch(from var(--triadic1) l c calc(h + 240));
}
body {
display: flex;
flex-direction: column;
place-items: center;
}
.container {
display: flex;
flex-direction: row;
gap: 1rem;
}
.box {
inline-size: 200px;
block-size: 200px;
border: 1px solid black;
/* optional */
display: flex;
place-content: center;
align-items: center;
}
.box01 {
background: var(--triadic1);
color: color-contrast(var(--triadic1) vs white, black);
}
.box02 {
background: var(--triadic2);
color: color-contrast(var(--triadic2) vs white, black);
}
.box03 {
background: var(--triadic3);
color: color-contrast(var(--triadic3) vs white, black);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.