Add dark mode to your website with a single line of code (github.com) 17 points by 0natcer 2y ago ↗ HN
[–] Alifatisk 2y ago ↗ > a single line of codeWhich means importing a whole js file [–] johnfonesca 2y ago ↗ And the JS file "weights" 4 Kb. [–] bravetraveler 2y ago ↗ It's fast though because it's minified and obfuscated to fit one line!!/s haven't even looked yet, but I like hyperbole as much as the next [–] wds 2y ago ↗ Add movement to your vehicle chassis with a single piece of whole engine
[–] johnfonesca 2y ago ↗ And the JS file "weights" 4 Kb. [–] bravetraveler 2y ago ↗ It's fast though because it's minified and obfuscated to fit one line!!/s haven't even looked yet, but I like hyperbole as much as the next
[–] bravetraveler 2y ago ↗ It's fast though because it's minified and obfuscated to fit one line!!/s haven't even looked yet, but I like hyperbole as much as the next
[–] emaro 2y 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 2y ago ↗ You don't need CSS either! <meta name="color-scheme" content="light dark" /> [–] OskarS 2y ago ↗ Not a web dev, but I saw this on a stream at some point and found it delightful. Surprisingly effective! html { filter: invert(100%); } [–] TazeTSchnitzel 2y ago ↗ Though you probably want to apply the same filter again to non-UI images so they won't look weird.
[–] OskarS 2y ago ↗ Not a web dev, but I saw this on a stream at some point and found it delightful. Surprisingly effective! html { filter: invert(100%); } [–] TazeTSchnitzel 2y ago ↗ Though you probably want to apply the same filter again to non-UI images so they won't look weird.
[–] TazeTSchnitzel 2y ago ↗ Though you probably want to apply the same filter again to non-UI images so they won't look weird.
8 comments
[ 47.2 ms ] story [ 671 ms ] threadWhich means importing a whole js file
/s haven't even looked yet, but I like hyperbole as much as the next