Live data from Hacker News

Please add a "dark" theme for Hacker News

news.ycombinator.com

61–70 of 81 posts

Re: Please add a "dark" theme for Hacker News

#61
post #6
post #5

The HN theme violates WCAG accessibility standards for text contrast[1] (which you can verify with your browser's dev tools), has paragraphs that are almost twice as wide as recommended for readability[2], uses font sizes that are unreadable for people with even slight impairments of visual acuity, and is near-unusable on small mobile devices. I'm all for improvements to the theme, which have been overdue for a decad…

Whats the briefest code change which would achieve these outcomes in a browser neutral manner? I hate to think of a massive .js burden to get there, I like sites that are both visually simple and mechanistically simple behind the text.

...why would any of that create a Javascript burden? Those are all HTML and CSS changes.

Re: Please add a "dark" theme for Hacker News

#62
post #60
post #8

Earlier quoted context omitted.

Or tampermonkey and 2 minutes of writing CSS overrides. What, you people are hackers, aren't you?

...which only works in some browsers.

Solution: use a browser that respect client-side overrides. You should be doing this anyways, if you want a usable adblock browsing experience. People that use Safari or flip-phone browsers don't reserve the right to complain about the web being unusable.

To quote Thom Yorke, "You do it to yourself, you do; and that's why it really hurts"

Re: Please add a "dark" theme for Hacker News

#63
post #22

What I'd* like to do is let people upload their own CSS and have HN serve it back to them. Then you can make your own darkmode (or anymode), and people can share them so you can reuse someone else's. One question this is contingent on: does there exist a well-defined secure subset of CSS such that we don't have to worry about weird vulnerabilities? * actually I think this was originally kogir's idea

You can introduce a dark theme for HN without feature flags or CSS upload. Support for `prefers-color-scheme` is widely supported in all the browsers[1]. It's how I handle it on my blog[2], I just swap out the colors based on the css selector.

1: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pref...

2: https://www.notcheckmark.com

Re: Please add a "dark" theme for Hacker News

#64
post #22

What I'd* like to do is let people upload their own CSS and have HN serve it back to them. Then you can make your own darkmode (or anymode), and people can share them so you can reuse someone else's. One question this is contingent on: does there exist a well-defined secure subset of CSS such that we don't have to worry about weird vulnerabilities? * actually I think this was originally kogir's idea

Isn't this just what userscripts/greasemonkey (and its forks) already does for any website?

That's for javascript, your want Stylish for CSS:

https://addons.mozilla.org/en-US/firefox/addon/stylish/

https://chromewebstore.google.com/detail/stylish-custom-them...

Re: Please add a "dark" theme for Hacker News

#65

It would be really appreciated for you guys to consider adding a dark theme for HackerNews. The reasons, well, could be added as comments here in the thread. Though, as you may imagine, it's mostly because of my eyes when I visit you guys without daylight.

Have people complaining of eyestrain from "light mode" considered checking their display brightness? Displays should match the brightness of their backgrounds, or in general somewhere around 100–150 cd/m² (aka 100–150 nits). Most monitors are capable of going much brighter than this, and really should not be used that way, because it tends to... cause eyestrain.

I find light mode painful even on minimum brightness.

Re: Please add a "dark" theme for Hacker News

#66
post #8

Earlier quoted context omitted.

Or tampermonkey and 2 minutes of writing CSS overrides. What, you people are hackers, aren't you?

So writing CSS overrides for every site I consume sounds healthy and fair to you?

Caring about the background color of a website is unhealthy and unfair. You have the client-side tools to fix it, so do it.

Re: Please add a "dark" theme for Hacker News

#67
post #22

What I'd* like to do is let people upload their own CSS and have HN serve it back to them. Then you can make your own darkmode (or anymode), and people can share them so you can reuse someone else's. One question this is contingent on: does there exist a well-defined secure subset of CSS such that we don't have to worry about weird vulnerabilities? * actually I think this was originally kogir's idea

As others have noted, this is possible on some browsers via extensions. I use Stylus with Firefox and have my own customised HN CSS. Mostly it inverts the main body / border colours, and uses sane font-size specifications, though there are some other tweaks. I've also got a "dark mode" variant. Both are linked from my profile page.

I'd prefer HN adopted my styling, obviously. But a dark-mode toggle would be pretty straightforward.

There are sites which have permitted customising CSS for ages, with Old Reddit being among the m better-known cases. The use-case differs there in that a subreddit's moderator(s) specify the style used by other members, which isn't how you're suggesting HN be modified. People footgunning themselves is lower risk, though it might result in more support.

Another option would be to offer a closed set of vetted styles, or to parameterise some of the CSS values (e.g., font properties, colours, etc.)

There are a few S/E / S/O posts addressing your question, with few deep concerns, though both are 10+ years old.

"security issues with user-supplied CSS?"

https://stackoverflow.com/questions/23502302/security-issues...>

"How dangerous is it to use CSS styles from an untrusted source?"

https://security.stackexchange.com/questions/24163/how-dange...>

Re: Please add a "dark" theme for Hacker News

#68
post #35

Earlier quoted context omitted.

Custom CSS risks being scope creep, IMO. A dark mode with options of a standard dark and a pure black dark would likely account for 99% of use anyways.

Custom CSS also means users can fix the designed-for-480p font sizes and paragraph widths, which the HN crew seem to have no interest in doing.

https://pastebin.com/gLXiqKyd> (from my HN profile).

That's more or less what I'm using as I write this.

Re: Please add a "dark" theme for Hacker News

#69
post #64

Earlier quoted context omitted.

Isn't this just what userscripts/greasemonkey (and its forks) already does for any website?

That's for javascript, your want Stylish for CSS: https://addons.mozilla.org/en-US/firefox/addon/stylish/ https://chromewebstore.google.com/detail/stylish-custom-them...

You can manipulate CSS/DOM with Javascript though.

Re: Please add a "dark" theme for Hacker News

#70

Whenever this topic came up about a decade ago, the argument against dark mode/theming was that it added complexity to Hacker News which has the explicit goal of being super simple. Now, with dark mode able to being controlled by CSS media queries and also able to be done automatically according to system preferences, the complexity argument doesn't hold. It's less complex than the later-added comment collapsing beha…

You know what would be even simpler? Not specifying colors or typefaces in the CSS at all and letting the user’s browser configuration style it.

If browsers innately and sanely supported default / assignable CSS that ... might be workable. I'd also much prefer browser's default styling was far more sane.

As things stand, some browsers (and, good news, those used by the overwhelming majority of desktop visitors) support CSS-management extensions such as Stylus.

But those don't work for all browsers, and aren't available in particular on Google Chrome/Android.

Firefox/Android does support Stylus, with some limitations: https://old.reddit.com/r/firefox/comments/qgsqob/stylus_for_...>.

Apparently not for Safari / iOS: https://github.com/openstyles/stylus/issues/299>

I've tweaked my own browser's default stylesheet in the past, and currently use a customised Reader View style for Firefox. Both are problematic, and changing the browser's default styling is probably best avoided these days. My Reader Mode view breaks somewhat and sometimes, but when it hits right, it's much better than stock.

Post reply on HN