Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
[flagged] Please add a "dark" theme for Hacker News (news.ycombinator.com)
49 points by aperezalbela 11 months ago | hide | past | favorite | 74 comments



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


This is a thing on private tracker websites, at least Gazelle based ones. You can give a custom URL to load CSS from. Not sure I've used any other websites that allow you to do this, though I wish there were more that did. I think the odds of people being victimized with this are pretty low and people could just skim the CSS beforehand if they didn't write it.


That's a cool idea, but it's not a substitute for meeting basic accessibility and readability needs. HN violates the WCAG accessibility standards for text contrast (your browser dev tools will happily point out which text is affected), it ignores platform fonts in favor of an outdated font stack that doesn't kern properly on many Linux devices, and it displays line lengths of up to 200 characters, even though research suggests that CPL should not exceed 70.

These are absolutely basic things, and fixing them should not require individual users to fiddle with CSS – even on a website called "Hacker" News.


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.


It won't fix the multiple "critical" accessibility issues[1] though, some of which require HTML changes for screen reader users.

[1] https://www.accessibilitychecker.org/audit/?website=https%3A...


Oh I agree. I'm sure if I was significantly blind I would never have joined this community.


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

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


https://jessicaotis.com/academia/never-use-white-text-on-a-b...

Myself and others with astigmatism literally cannot use "dark mode", tastefully done it's fine tho, talking stuff like Nord theme, monkeytype.com etc as long as it's not straight black and white.


We get a lot of requests for UI modifications beyond dark mode.


Classifying and prioritising those, and perhaps sharing some of the list, would be a good first approach even if you don't go further.

It'd also be helpful to request rationales for why different modes are requested.

My own major gripes about HN:

- Default font is too small. Screen sizes, resolutions, and dot pitches have evolved dramatically since 2007, in multiple ways. One Size Does Not Fit All. (FIMS -- fixed in my style)

- Default colour scheme is just plain hard to read, all the more so on e-ink (which I use for much of my reading). (FIMS)

- Voting controls are too hard to hit, and easy to confuse. (FIMS)

- For those who want that sort of thing: no dark mode. (Fixed in my other style.)

- Text dialogue too small. (FIMS)

- Various navigation / mode elements hard to distinguish. (FIMS)

- Embuttoning action links ("reply", "more"). (FIMS)

- Providing additional colour context to additional screen elements. (Fixed in my personal style, not on the shared style.)

Going back to the default HN style always feels exceptionally jarring.

Outside CSS tweaks, I'd prefer at least a proper quoting/blockquote style. HN doesn't need to go full Markdown (though That Would Be Nice), but this is one key lacking feature.


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...>


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


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



You can manipulate CSS/DOM with Javascript though.


HN already lets you edit the top bar color, just repeat that with extra fields for the rest of the layout, and maybe add font size to boot. The UI of the user panel would be slightly more complicated but it would be no less safe than what you already have. And if you want to get fancy, you can use the HTML5 color tag.

edit I see you just answered another similar comment, but I'm still going to obstinately argue for it because it's the simplest and safest solution. There's nothing wrong with adding UI elements when you're adding new functionality. And that extra complexity is still less complex than something more superficially "elegant" like an internal CSS parser.


> extra fields

That leads to settings hell and I don't want that complexity curve.


If you want people to be able to use custom styles, that's extra complexity regardless. If you let people upload their own stylesheets, you need storage for potentially millions of extra files, validation, size limits, etc. All of the hazards associated with arbitrary file uploads.

Or extra fields. Then all you're dealing with is a few more color values on the backend for a stylesheet that's already being generated by code. It's a lot easier to validate a color (the code for which is already there) than an entire nearly Turing complete language.

You could even split the difference and have themes generated from one or two user supplied colors, instead of fields for each css value.


Make it a github repo anyone can add their username.style.css to, put them to web, and show to each user when they open username's page (maybe with a userscript through githack URLs) After you have a hundred, you can infer the subset that is "generally enough " If the CSS maker userbase is small enough you may just manually check they are fine and pick a small subset to make available for everyone


> does there exist a well-defined secure subset of CSS such that we don't have to worry about weird vulnerabilities?

I don’t know the answer, but if it is “no,” would it be feasible to add a few more user settings ala topcolor to achieve a more basic version of this?


The intention is to avoid adding user settings, while still giving people a way to make the UI how they like it.


Just let people host their own CSS file, and link it the user's prefs?


Guess not :D


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 behavior and navigation.


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.


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 decade, but adding a dark variant is not the most pressing issue, to put it mildly.

[1] https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum...

[2] https://www.researchgate.net/publication/234578707_Optimal_L...


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.


Replace the outdated font stack with `system-ui` in CSS, remove all `font-size` directives, remove the gray-ish background, make the light-grey text slightly darker. This fixes many accessibility issues with not a single line of JavaScript required. Mobile usability is more difficult, given that HN relies on tables for layout.

I also can't find a single ARIA attribute in the HTML code. Between that and the absence of semantic elements, I wonder whether screen reader users can navigate HN at all.


I'd suggest a two phase approach. 1) come into conformance with the least possible change to current experience, and 2) make the structural change which might change current user experience but provides for assisted access improvement. I'm not a fan of big-change, and I am of a belief most of the current HN mob are pretty OK that it remains much as it is (not that they are unwilling to countenance change but there's a certain curmudgeonly love of this being an un-lovely site. -And I certainly don't think we deliberately don't want to help people who have to rely on semantic element aware readers)


This isn't the first time these issues have been brought up though. Or even the tenth time. I've seen many small open source projects make accessibility a top priority, actively seeking feedback from visually impaired users, going through multiple prototypes etc. With HN, this just continues to not happen. I could produce a 10-line CSS patch that would solve lots of issues, but at this point I have no reason to believe it would be accepted.


If you offer Dan a 10 line patch which changes nothing in the normal case, but improves things for visually impaired users, I would be surprised if he didn't accept it. I agree there is a low level of visible engagement but I've always found him (and his sidekicks) amenable to reasonable exchanges off this page.


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


I would probably drop HN altogether if it constrained itself to a tiny 3” column down the middle of my browser like other obnoxious sites do. I paid for a nice 27” monitor and I expect to use the whole width. If I wanted to constrain the content to a narrow column I would resize the browser window. The content width should be left to user preference.


someone posted a ublock origin filter a couple weeks ago... ``` !Hacker News dark theme news.ycombinator.com##body:style(color: #CCCCCC !important; background-color: #1A1A1A !important; ) news.ycombinator.com##table:style(background-color: #2B2B2B !important; ) news.ycombinator.com##input:style(background-color: #DFDFDF !important; ) news.ycombinator.com##table, tr, td, .pagetop, .score:style(color: #CCCCCC !important; ) news.ycombinator.com##td:style(border: 1px solid #2B2B2B !important; background-color: #2B2B2B !important; ) news.ycombinator.com##b:style(color: inherit !important; ) news.ycombinator.com##a, .c00:style(color: #eee !important; ) news.ycombinator.com##.c00 a:style(color: rgb(49, 140, 212) !important; ) news.ycombinator.com##.comhead, .subtext:style(color: #828282 !important; ) news.ycombinator.com##.comhead > a, .subtext > a:style(color: orange !important; ) news.ycombinator.com##.comhead font:style(color: #5a5a5a !important ) news.ycombinator.com##.c5a, .c88, .c9c:style(color: #999 !important; ) news.ycombinator.com##input:style(color: black !important; ) news.ycombinator.com##textarea:style(background-color: #E0E0E0 !important; border-left: 12px solid #CCCCCC !important; ) news.ycombinator.com##font[color="#000000"]:style(color: #a3b72c !important; ) ```

can add it as a custom filter.


Man, I always forget that ublock can do that. Here I am with a self-rolled firefox extension to do a dark theme on this site when this probably works even better...


I think it's important to understand that supporting dark mode by default makes websites work properly also in situations where you are not logged in, or you aren't using your regular web browser with all its customizations and extensions installed.

It's very little work and has lots of benefits.


There are browser extensions and userscripts to do this.


Like https://darkreader.org/ that costs?


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"


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


It's easier than you'd think.

In many cases, you can probably get by with your browser's default Reader Mode.

I'll use uBlock Origin's element zapper on a whole heck of a lot of sites, and you can write default rules for common annoyances as well.

If you get fancy, you can write generalised styles which address specific annoyances, and toggle those on or off on specific websites.

Otherwise, I'd found I'd written a thousand or so custom styles over a couple of years at one point. Most were quite elementary (usually font tweaks or removing headers / social link-litter). A few ... somewhat less elementary. Taught myself a lot about CSS in the process.


I don't think they meant that it would be needed to make new overrides for every site typically. Dark Reader extension works fine with 99% of sites out of the box and is free.


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


No, just the ones you really care about.


You're right. Someone should do it for you, for free. /s


Dark Reader is free and open source software, always has been. That price on the main page is just for a voluntary donation if you so desire.

The free download buttons are in the middle of the page. There are also multiple links to the source code at the bottom.


Not true. You must install from the AppStore and it charges you.


You seem to be referring to the ios/mac app store thing specifically, which is NOT what 99% of people use. That is a separate whole browser with the extension pre-installed and completely unnecessary.

Just use the links in the middle of the page and it will install it for free like every other normal browser extension people use all the time.

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

The firefox extension alone has 1 million installs just from this page, we all installed it for free and have been using it for years. I think asserting that there are only paid options is disingenuous to say the least.


iOS embedded safari doesn’t run them unfortunately.

I mainly read HN from an RSS reader, whose web view always shows light mode.


How about in Safari?



Thanks! Appreciate it


Doesn’t work in web views unfortunately.


Aren't Hacker News users supposed to be able to hack it easily?


Hackers also use banks. Are them supposed to hack them as well?


> Hackers also use banks

Modifying CSS on my machine for my viewing isn’t comparable to hacking a bank.


I'm not comparing on those terms. I'm comparing about "being supposed" to do something. We may have the ability, but that doesn't mean that we will do everything we have the ability for.


[flagged]


You may. But you are not supposed.


Dark mode, chronological, no click Hacker News: https://excuse-seven.vercel.app

View the most recent 500 Hacker News articles in chronological order with all their first-order comments in view. Do not click to flip the page, do not click to see the comments.


What I’d like is a prioritization of fixing the long neglected UI and UX. Start with fixing accessibility (vision, motor, etc.) first.

Dark mode can come after that (some may want dark mode all the time, some may want it to obey system settings, some may want a simple toggle on every screen).


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 have brightness on high since every other application and website I use has a dark mode and I get blinded when switching to Hacker News.


Effective luminosity isn't just a function of how much light the device can output at a given setting but also how much light is being blocked or is otherwise not emitted by the image being displayed. By making the background dark and the relatively sparse text light, you can lower overall light output while preserving more of the contrast.

And low contrast can also cause eye strain.


I find light mode painful even on minimum brightness.


Try out chrome://flags/#enable-force-dark (on any Chromium browser like Chrome, Edge, Brave) to make all websites dark mode


I use Opera's night mode on mobile, I think one of the best browsers for out of the box dark mode and text reflow.


Trivial to do in Brave (for MacOS or iOS).


It uses a chromium flag so brave://flags/#enable-force-dark or chrome://flags/#enable-force-dark or edge://flags/#enable-force-dark should all work


+1




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: