Dark mode does not need a second block of overrides for every color.
:root { color-scheme: light dark; }
body { color: light-dark(#1f2328, #e6edf3); background: light-dark(#ffffff, #0d1117); }
light-dark(a, b) returns the first color in a light scheme and the second in a dark scheme, following the visitor’s system setting. It only responds when color-scheme is set to light dark on the element or an ancestor, which is why the first line is there. I use it for colors, and when a theme changes many other values at once, a prefers-color-scheme media query is still the better tool. MDN lists it as widely available since May 2024.
Further reading: MDN: light-dark()