I did this recently for my new personal website! It's quite easy and really satisfying. I love doing as much as possible in stateless CSS instead of JavaScript. http://www.brandonsmith.ninja/
Same here: https://phili.pe/ I've used CSS variables though, which make it even simpler. E.g. I have `--page-background-color` and `--text-color-primary` that are set to a certain default value. In dark mode, these variables are set to other values, removing the need to redefine the actual selectors.
Dark mode in a website with CSS
21–30 of 191 posts
Re: Dark mode in a website with CSS
#22https://medium.com/@mwichary/dark-theme-in-a-day-3518dde2955...
Re: Dark mode in a website with CSS
#23Shameless plug: I did the same thing to my personal website and wrote about it with light/dark screenshots: https://www.reillywood.com/blog/dark-mode/ I like working in Solarized Dark, so I wanted my website to serve up Solarized Dark. I dim images in dark mode too, but I turn them up to full brightness on hover.
I only use Solarized for code snippets on my website, but the benefit of using it as a color scheme is that switching between the two is a one line addition: only the background needs to respond to prefers-color-scheme.
Re: Dark mode in a website with CSS
#24Now if only Hacker News would implement it!
Re: Dark mode in a website with CSS
#25Now if only Hacker News would implement it!
Re: Dark mode in a website with CSS
#26I recently added dark-mode support to a few sites. It took way more time then I thought it would. At first I thought "oh just add a few lines off CSS" but then ... * Some diagrams had white backgrounds Solution: remove the backgrounds so they are transparent * Most diagrams had black lines/arrows which didn't look good on dark gray backgrounds Solution: use CSS filter:invert for images * Some images are photos not di…
Re: Dark mode in a website with CSS
#27Re: Dark mode in a website with CSS
#28Now if only Hacker News would implement it!
Re: Dark mode in a website with CSS
#29Does not seem to work in Firefox for Android.
Re: Dark mode in a website with CSS
#30Now if only Hacker News would implement it!
I currently use 'DARK READER' for hacker news and it works quite well using the 'Filter+' theme engine.
Works great.