CSS; use color-scheme property to apply a default to user-agent stylesheet; “< system-color > keywords reflect default color choices made by the user, the browser, or the OS.";“Yes, it will work — but pure black and white is a bit boring.”

This is namesache.com dark mode as of posting; Simple, easy application of accessibility feature that can be refined and replaced as required.

CSS; prefers-color-scheme media-query; CSS Custom Properties to select colours.

Also simple and easy option, providing designer with more control.

Javascript; Toggle option.

Dark Mode in 3 Lines of CSS and Other Adventures by Mads Stoumann @ DEV Community