4 ms·
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'
by emaro 3y ago
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.
- rollcat 3y agoYou don't need CSS either! <meta name="color-scheme" content="light dark" />
- OskarS 3y agoNot a web dev, but I saw this on a stream at some point and found it delightful. Surprisingly effective! html { filter: invert(100%); }
- TazeTSchnitzel 3y agoThough you probably want to apply the same filter again to non-UI images so they won't look weird.