:root { --varname: #FFE; }
@media (prefers-color-scheme: dark) {
:root { --varname: #022; }
}
Edit: To expand on this, I dislike light/dark toggles. If I have dark mode on, seeing a bright screen and having to search for a toggle is jarring. Just show me the colours according to my preference!I used this on a personal project to add a README logo that is dark mode friendly: https://paul.af/github-readme-dark-mode