You can in fact add dark mode with a single line of code (CSS, not JS), as long as you don't change any colors:
:root { color-scheme: light dark; }
I don't think you need a library for that.