Great tip here from Jhey. He advises using a button
with ARIA and a little JavaScript for your dark-mode toggle. And to apply the dark styles, use a CSS selector which targets the :root
parent of the button when in “pressed” state and sets a root-level custom property to “on”.
Seriously clever stuff!
And aside from the CSS, I really like the way Jhey advocates using a button
rather than a form element such as a checkbox for this kind of interface, much like Léonie did recently.