The goal of DRY (Don’t Repeat Yourself) programming is to avoid redefining custom properties when switching between light and dark modes. Florens Verschelde asked about defining dark mode styles for both a class and a media query, without repeat CSS custom properties declarations. I remembered Lea Verou’s trick using --var: ; , and found a way to make it work.

3m read timeFrom css-tricks.com
Post cover image
Table of contents
Even DRYer with pre-processors
4 Comments

Sort: