Enable dark mode on Appearance/Customize/Colors & Dark Mode/Dark Mode Support
To enable dark mode by default on Twenty Twenty-One theme, put this script inside the theme:
<script>
// turn on dark mode by default.
if (localStorage.getItem("twentytwentyoneDarkMode") === null)
{
localStorage.setItem("twentytwentyoneDarkMode", "yes");
}
</script>
The easiest way to put Javascript on your site is by using (free) Insert Headers and Footers plugin.
Download and activate the plugin, paste above code in “Scripts in Header” section and you’re done.
Keep in mind that this script automatically sets the cookie which would normally be set only if user clicks on ‘dark mode’ button.