News for hackers. Stuff that matters.
Re:Ask HN: Dark mode for HN please? by ochoseis on Friday May 15, 2020 @09:45PM (#23199715)
For the sake of simplicity, could we just serve up a subdomain darknews.ycombinator.com, same content, just different stylesheet?
Re:Ask HN: Dark mode for HN please? by pjscott on Friday May 15, 2020 @10:10PM (#23199855)
When you click on a link to the news.ycombinator.com domain, what should happen if you prefer dark mode? And vice versa?

In comparison, the pure-CSS ideas that some people are posting would work automatically if your browser supports dark mode, and would enlarge the (cached with long ttl) CSS file only very slightly.

Re:Ask HN: Dark mode for HN please? by DenseComet on Saturday May 16, 2020 @12:39AM (#23200533)
Unfortunately, there are some of us who also like the solarized type light mode in HN more than dark mode, but we use dark mode at the system level because the OS light mode is awful.

Pure CSS would be quite cool, but we'd probably also need a snippet of JS to add a button allowing to switch between light and dark mode. (There's probably a way to do it without JS that someone will hopefully comment too.)

Re:Ask HN: Dark mode for HN please? by noisem4ker on Saturday May 16, 2020 @05:42AM (#23201982)
They could put a preference in the profile page. But I think that switching the theme would be the browser's job.
Re:Ask HN: Dark mode for HN please? by dharmab on Monday May 18, 2020 @10:30AM (#23222729)
By using CSS variables, only a few lines of JS are needed- small enough that they can be inlined in the HTML.
Re:Ask HN: Dark mode for HN please? by IAmGraydon on Friday May 15, 2020 @10:30PM (#23199970)
I don’t think you’ve properly considered what a terrible idea this is.
Re:Ask HN: Dark mode for HN please? by djjsjdjsjsjs on Friday May 15, 2020 @10:36PM (#23199993)
Please explain as I am curious
Re:Ask HN: Dark mode for HN please? by dharmab on Friday May 15, 2020 @11:04PM (#23200123)
Adding dark mode CSS adds a few hundred bytes, maybe a couple kb at most to the site.

A separate subdomain:

- Requires separate TLS certificates to be maintained.

- Doesn't play nice with caching.

- Doesn't play nice with password managers.

- Doesn't work with any existing links. Users would have to manually add the `dark` prefix.

- Is generally a bad user experience.

Re:Ask HN: Dark mode for HN please? by deadbunny on Saturday May 16, 2020 @06:58AM (#23202400)
While I agree with most of your points, I disagree with

> Doesn't play nice with password managers.

Check your password manager settings. Most have options to match on domain, subdomain, port or have the ability to set equivalent domains either globally or per credential.

Re:Ask HN: Dark mode for HN please? by PenguinCoder on Friday May 15, 2020 @09:58PM (#23199787)
That's not simple at all..
Re:Ask HN: Dark mode for HN please? by majewsky on Saturday May 16, 2020 @11:23AM (#23204124)
Tagline: "Come to the dark site."