@olivierlacan Neat! One pitfall, though: this approach breaks on browsers that don’t support `prefers-color-scheme`, or for users who have it set to `no-preference`. Here’s my suggestion: web.dev/prefers-color-…. See it in action on my blog.
JavaScript regular expressions: `.lastIndex` and the flags /g and /y: 2ality.com/2020/01/regexp…. One of my nastiest bugs in my career so far involved learning about this. Highly recommended reading! 🙇♂️