/* Auto light / dark — follows prefers-color-scheme */
:root{
color-scheme: light dark;
--text-color: hsl(0, 0%, 18%);
--heading-color: hsl(0, 0%, 18%);
--background-color: hsl(0, 0%, 99%);
--bg-color: hsl(0, 0%, 99%);
--link-color: hsl(0, 0%, 18%);
--visited-color: hsl(0, 0%, 18%);
--blockquote-color: hsl(0, 0%, 18%);
--code-bg-color: hsl(0, 0%, 95%);
--code-color: hsl(0, 0%, 18%);
--sub-color: hsl(0, 0%, 29%);
}
@media (prefers-color-scheme: dark){
:root{
--text-color: hsla(0, 0%, 93%, 1);
--heading-color: hsla(0, 0%, 93%, 1);
--background-color: hsla(0, 0%, 0%, 1);
--bg-color: hsla(0, 0%, 0%, 1);
--link-color: hsla(0, 0%, 93%, 1);
--visited-color: hsla(0, 0%, 93%, 0.85);
--blockquote-color: hsla(0, 0%, 93%, 1);
--code-bg-color: hsla(0, 0%, 8%, 1);
--code-color: limegreen;
--sub-color: hsla(0, 0%, 93%, 0.78);
}
}
/* Preview layout */
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
padding: 24px;
box-sizing: border-box;
background: var(--background-color);
color: var(--text-color);
font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.trace-svg{width:min(100%,300px);height:72px;overflow:visible;color:inherit}
.trace-svg path{
fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;
opacity:.85;
}
Usage
From Mighil's animation sketches. Original demo and notes: https://mighil.com/animations/path-trace
The Theme block at the top of the CSS sets the light/dark variables; map them to your own design tokens.