You, as a developer who blogs, don't need Javascript to support dark mode!

The word is progressive enhancement. CSS prefers-color-scheme media query should just work!

If you wish to then allow the user to manually switch between dark and light mode, you can do that with JS, but the dark mode feature on your blog should first respect the user's OS' dark mode setting. This also might be needed if the user's OS doesn't have an option that affects dark mode or they don't if such a setting exists. Then you also should think about what the default should be. I would default to dark mode if my target audience preferred that. Would I be biased to believe that most programmers prefer dark mode by default?

For instance, Shawn's site doesn't support dark mode without JS.