Lurker News
Of all places, HN should be dark mode by default, without any of us using a plugin or specific browser. I don't want my eyes to burn when I'm browsing HN at night on my phone. Anyone?

Comments (445) 93 threads

dang38 replies#
Ok, you guys, this isn't the first time we've heard this request (https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...). I'm willing to do it (edit: not to change the default! just to add the option). It's just that any CSS issue that goes more than a quarter-inch deep is outside both my expertise and my interest.

We can add CSS to https://news.ycombinator.com/news.css for prefers-color-scheme: dark, but that leaves open the question of specifically what CSS to put in there. Anyone who wants to make a suggestion is welcome to. Post it in this thread so others can comment, or email it to hn@ycombinator.com. I've roped Zain, YC's designer, into helping with this, and we'll come up with something.
p.s. If you're inclined to post "this is 2020, how come HN doesn't $thing", remember our motto: move slowly and preserve things: https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que.... When I say slowly I mean slowly. This is also called alligator energy. https://news.ycombinator.com/item?id=16442716

lowdose2 replies#
Would it be an idea to open a github repo for this and let the community contribute their efforts there?
dang#
That comes with a high level of user expectations that we couldn't possibly meet.
ubercow131 reply#
Looking forward to the pull request finally modernising HN into a React SPA
_bxg11 reply#
It's possible not everyone will realize this is /s :)

Continue this thread — 1 reply

_bxg11 reply#
This commenter linked their own custom stylesheets that they've already been using: https://news.ycombinator.com/item?id=23198500

I haven't inspected their quality or thoroughness myself, but it seemed like a certain amount of that was implied

dang1 reply#
Ah, I'm glad you mentioned that; I took a look at it earlier, but I think what would be most helpful is just the most minimal set of CSS we could put in curly braces after prefers-color-scheme: dark. In other words, a patch to https://news.ycombinator.com/news.css that would strictly only add lines—and preferably the most minimal that would do the trick.
_bxg1#
For sure. I can try and whip something up later tonight if no other solution presents itself before then. I can email it or post here.
kazinator1 reply#
Right now, the profile has a single property "topcolor" where you can slightly customize HN. It seems that this could easily be extended with a few more similar properties, suitable values of which could produce a darkmode.
dang5 replies#
I'd love to do that just by offering people a CSS blob that we could inject into their CSS when they browse HN. Our original idea (actually kogir's idea from back in 2014—he's a forward-thinking guy) was that people could create skins this way, if that Winamp-era term isn't too obsolete by now, and share them.

However, someone who is plugged into Reddit told me that they used to allow user-defined CSS for customizing subreddits and had to roll it back because of security issues. They built an entire customization UI instead. That scared me off the idea.
My fear with a customization UI—the HN equivalent of which would be profile settings, as you indicate—is that it would get way too complicated too quickly. How many additional settings would we need?
If someone can define a not-too-complicated set of profile settings which, when filled in to taste, would solve people's dark-mode concerns, I'm all for it. We could even make a separate editor page for it and link to that from the profile. The other constraint is: for each setting, the input format would need to be simple to sanitize (e.g. 'valid hex color'). Otherwise we just create the security issue all over again, only with a shitty nonstandard application-level CSS editor instead of standard CSS.

krapp#
>If someone can define a not-too-complicated set of profile settings which, when filled in to taste, would solve people's dark-mode concerns, I'm all for it

I posted a possible solution in another comment here[0]. You would have to write a separate dark theme, and there would be a single option to select it in the user panel. The data is literally just an integer pointing to an index in a whitelist of css filenames, and any errors would default to displaying the existing stylesheet.
[0]https://news.ycombinator.com/item?id=23198711

toupeira4 replies#
Reddit's user CSS was different, mods could edit it on subreddits and all visitors would receive it. On HN you'd only get the CSS you've set yourself, so there shouldn't really be a security concern (except for CSRF attacks against the settings form I guess).

Continue this thread — 4 replies

abtinf1 reply#
I would love to be able to define my own CSS that simply replaced the site’s settings, not just for dark mode. It would let me make changes that would be extremely useful to me.

For example, I’d hide the “hide” links on the main page. I’m sure some people love that feature, but I’ve only ever used it accidentally (fatfingering on mobile).
I’d add a bunch of additional hiding CSS. I’ve long wanted a “helps-me-respect-my-time” version of HN, where voting buttons, flag links, reply boxes, and reply links are all hidden.

Continue this thread — 1 reply

c22#
I think background color and text color options with inverted voting arrows (as suggested elsewhere in this thread[0]) would be enough for most people.

What.cd used to let you put a url in your settings that was injected as the stylesheet while you were logged in. This approach would let people publish and share themes--though shared themes could be a (pretty visible) security concern.
I remember also running into issues trying to use non-https-served stylesheets since the site was https and browsers balked.
[0] https://news.ycombinator.com/item?id=23199725

aasasd1 reply#
I previously customized HN a bit via my own CSS additions, with the Stylus browser extension. Personally I think that's a more feasible route for personalization than an interface for that on the site itself. However, there's a problem that HN's HTML layout doesn't lend itself to CSS work: you end up describing elements in terms of ‘a div two items down from the one embedded in that thing’, instead of just using classes. Sprinkling around some classes might be something to look at, for providing users the ability for customization. This should be pretty safe. I'd also say that the structure could be more semantic—but that may break browser extensions and similar existing customization.

P.S. I hurried to this thread because I noticed that the ‘collapse comment’ links became larger on my phone and I can finally hit them on the first try. Thanks to whoever did that, sincerely! Though personally I'd encourage you/them to make the link three times wider still, to take away even more effort. Dunno if it's much visual noise to others, but at least I don't think it encroaches on other elements.
Btw, another hopefully-not-controversial change that I would make is to have the post text black, not gray. It's a pretty important element, isn't it? So it should have high contrast and be readable.

Continue this thread — 1 reply

zainali3 replies#
I'll check this thread but also feel free to email me zain@yc for more feedback - just add [HN FEEDBACK] in the subject :-)

don't worry, we'll make sure we don't pull a reddit on you ;)

ldd1 reply#
I replied to the top post, but just in case, here is my idea

It uses prefers-color-scheme and 28 lines of CSS:
https://pastebin.com/4JYbSi5F

Sebb767#
> we'll make sure we don't pull a reddit on you

From all of my heart: Thank you!

jedberg#
> don't worry, we'll make sure we don't pull a reddit on you ;)

As a shareholder of reddit, that hurts.
As a user of reddit and HN, thank you, I couldn't agree more.

jimmyswimmy16 replies#
Please, for God's sake, don't screw it up. I can keep up with news on this site from a 15 kb/s shared satellite link when I'm out at sea. Except perhaps for the really big threads. I love the simple interface. It's text, it's simple, it's readable, and when I hit the spacebar, it scrolls down a page. No fancy fonts, no javascript, no nothing. I love HN for its simplicity and speed. Thanks for maintaining a good engineering philosophy.
aaomidi#
Completely agree with you
dang8 replies#
I'm on board with ceasing and desisting from screwing it up.
merlinsbrain#
Thank you dang, you've been an amazing steward for this community and the technology that powers it.

Keeping something the way it is, is super hard in tons of ways a lot of us probably don't understand. We appreciate you.

fermienrico5 replies#
Can we have a review before we merge the change? Make sure all issues are ironed out.

HN design is simply the best thing out there. "Moving slowly and preserving things" - I would get this engraved on my grave. This philosophy has died unfortunately and with it went robustness, simplicity, elegance, poise, beauty, accessibility, elegance, maintainability and practicality.
Thanks dang for your gandalf-like wisdom and your resilience. I like Alligators over goddamn mosquitos that have taken over the internet.

Continue this thread — 5 replies

Continue this thread — 6 more replies

Continue this thread — 14 more replies

Continue this thread — 33 more replies

monokai_nl9 replies#
I took a shot at it:

https://monokai.nl/lab/hacker-news/hn-dark1.png
https://monokai.nl/lab/hacker-news/hn-dark2.png
https://monokai.nl/lab/hacker-news/hn-dark3.png
The principles I followed:
- Alligator energy. No need to redo the layout or apply the latest design trends. HN is fine as is.
- Respect the original design. The dark version uses the same color hierarchy as the elements in the original design.
- No-nonsense. All colors are pure grayscale.
- Simple. Only minimally adjusted the CSS ( https://monokai.nl/lab/hacker-news/news.css ). This can be easily implemented in the current CSS using some media queries. I only added one thing in the HTML which is a span around the karma points at the top.
- Keep the orange. This was a puzzle. I think the original bar is too jarring on a dark background. But, HN is not HN without a touch of orange. I decided to style the top links only. This keeps the soul of HN.
- Readability. You should be comfortable reading this dark mode in low light. Too much contrast doesn't read nicely, but the original HN text has a lot of contrast with its #000 on an off-white background. My dark background is off-black and the text is turned down a notch from pure white. If you need less contrast, you can turn down the brightness of your display.
- The upvote triangles are unicode now inserted via CSS. Saves a request and doesn't render pixelated on Retina.
- Best thing. All comments are placed on a big slab of #2a2a2a. That's triple the answer to you know what.

ship_it#
I love it! Looks natively enough.
Aeolun#
That’s the best one I’ve seen so far. Especially how you dealt with the top bar.
rkudeshi#
This is definitely my favorite and retains the unique HN look.
lucb1e1 reply#
I love the top bar, this is fantastic. Saw the domain, then your username, then the bio: "Author of the original Monokai color scheme". I didn't know there was a person behind it, I thought it was just a name! Sounds like you should definitely be on the Hacker News Color Advisory Committee to make this work well for everyone given your experience in designing dark modes.
monokai_nl#
Yeah, Monokai started as a color scheme for Textmate which I just made for myself somewhere in 2006. I named it after my company name and put it on the Textmate wiki. It took off after that.

I'll gladly accept a humble place in the HN Color Advisory Committee :)

haack1 reply#
Good job preserving the HN spirit!

My only feedback is the gray text (#808080) on the dark gray background (#222222), has a contrast ratio of ~4:1 which some people may find difficult to read (and slightly below WCAG recommendation for regular text[1]). I think you can lighten the text slightly without disrupting the surrounding color hierarchy.
[1] https://webaim.org/resources/contrastchecker/

monokai_nl#
Contrast ratios that are mathematically derived are not always nice or correct. It's notoriously hard to determine perceived brightness from hex codes. That said, it might need some tweaking. I only spent a little time on it and I know it helps to revisit a color scheme a couple of times during different light circumstances.
bborud1 reply#
The tracking is too tight for light-on-dark.

You focused on colors and forgot about the content. You can't just invert colors and think that the typography automatically works. It often doesn't.

monokai_nl1 reply#
I didn't touch the typography indeed, but I also didn't just invert the colors. What would you suggest to do with the typography to make it better?
bborud#
Light letters on dark background need more light to maintain legibility. So you might have to increase the point size and adjust the weight and increase leading and tracking. The counters are important for legibility so pay attention to how the font is affected by inversion.
mmmBacon1 reply#
A question, how would the black bar appear in dark mode? It should be set out somehow. Also would be useful if when the black bar appears there’s a link to the person honored.
monokai_nl1 reply#
Which black bar do you mean exactly? I decided to let go of the full orange bar and give the text an orange color instead. I think it looks more balanced.

Continue this thread — 1 reply

Continue this thread — 2 more replies

_bxg119 replies#
> HN should be dark mode by default

A less controversial solution would be to simply hook into the user's system-level light/dark setting: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pref...
That said, I've wanted this feature desperately for a long time. Browsing HN on my desktop monitor in the evening is blinding and gives me a headache. I find myself resizing the window to be phone-sized just so my eyes are assaulted with less light.
If you need a hand with the CSS, I'd be happy to write it myself (speaking of which; is HN open-source?)

Continue this thread — 19 replies

clan2 replies#
Whilst touching the CSS. Could it be considered to fix the code overflow on mobile?

    It is the effect of having a line which is longer than the viewport - so we end up having to scroll that specific line. Some might say it is better not to wrap code but I more often see this as part of a quote. I you really do not like to wrap the lines then I would prefer a scrollbar on the whole section. (I hope this line demos the issues).
I am not asking for mobile CSS. It is just on mobile it is most obvious.

My CSS knowledge is severely limited but I was thinking something along the lines of

    pre {
            overflow-x: auto;
            white-space: pre-wrap;
            white-space: -moz-pre-wrap;
            white-space: -pre-wrap;
            white-space: -o-pre-wrap;
            word-wrap: break-word;
     }
Others might have better ideas. Please chime in.

I salute the credo of moving slowly. And I hate to be a cry baby. I even hate the feature creep. But here I am :-}

Continue this thread — 2 replies

Load more comments