Minimal dark mode styles for Hacker News

(antonz.org)

36 points | by ingve 3 hours ago ago

19 comments

  • nwah1 22 minutes ago

    Been using this with the Stylus browser extension. It works great. My favorite minimalist dark theme for HN.

    https://userstyles.world/style/1898/hacker-news-dynamic-dark

  • ralgozino 42 minutes ago

    You can style pages using uBlock Origin too, I configured the following custom filter under My Filters to:

    1. Increase the font-size 2. Remove the white background for light mode 3. Respect system dark mode and have a nice dark theme

    Snippet (hopefully HN renders it ok):

      ! Hacker News: bigger text + soft light theme + dark theme that follows the system setting
      news.ycombinator.com##html:style(zoom: 1.25 !important)
      news.ycombinator.com##.comment, .commtext:style(font-size: 10pt !important; line-height: 1.45 !important)
      news.ycombinator.com###hnmain:style(max-width: 960px !important)
      
      ! Light
      news.ycombinator.com##:matches-media((prefers-color-scheme: light)) body, #hnmain, input[readonly]:style(background-color: #f1eee6 !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: light)) .subtext, .comhead, .subtext a:link, .comhead a:link:style(color: #666 !important)
      
      ! Dark
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) html:style(color-scheme: dark !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) body:style(background-color: #111 !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) #hnmain, input[readonly]:style(background-color: #1c1c1c !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) td[bgcolor="#ff6600"]:style(background-color: #b34700 !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) .pagetop, .pagetop a:link, .pagetop a:visited:style(color: #111 !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) body, td, .default, .title, .subtext, .comhead, .yclinks:style(color: #8f8f8f)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) a:link, .c00, .c00 a:link, .admin, .admin td:style(color: #dcdcdc !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) a:visited, .subtext a:link, .comhead a:link:style(color: #8f8f8f !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) .c5a, .c5a a:link, .c5a a:visited:style(color: #a8a8a8 !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) .c73, .c73 a:link, .c73 a:visited, .c82, .c82 a:link, .c82 a:visited:style(color: #8a8a8a !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) .c88, .c88 a:link, .c88 a:visited, .c9c, .c9c a:link, .c9c a:visited:style(color: #707070 !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) .cae, .cae a:link, .cae a:visited, .cbe, .cbe a:link, .cbe a:visited:style(color: #575757 !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) .cce, .cce a:link, .cce a:visited, .cdd, .cdd a:link, .cdd a:visited:style(color: #424242 !important)
      news.ycombinator.com##:matches-media((prefers-color-scheme: dark)) input, textarea:style(background-color: #262626 !important; color: #dcdcdc !important; border: 1px solid #444 !important)
    
    
    You can tweak them as you please :)
  • lumpa an hour ago

    Thanks, the snippet to zoom the page on wider screens worked a charm on Firefox with Dark Reader.

  • zurfer an hour ago

    @dang please. A little "dark"/"light" in the footer.

    • etatester an hour ago

      No need. Just add the media query. Your OS/browser already provides "a little dark/light" toggle.

    • Cider9986 an hour ago

      @dang does nothing. You can email hn@ycombinator.com.

      Personally I like oj-hn.com but I wouldn't be opposed to a built in one.

  • frereubu 4 minutes ago

    I like the refusal of HN to do anything about this - I come here partially because of the ascetic approach to its design. If they listened to everyone over the years the site would probably be some kind of bloated React mess, and if there's anywhere that people can roll their dark mode surely it's HN (as the linked post and many comments here prove...)

  • kleiba2 19 minutes ago

    I regularly have the opposite problem: for some reason, my eyes cannot handle dark mode. Like, it literally takes me a second or two after I looked at a dark mode render to see properly again. I think it's just age because I had no problem coding on MS-DOS in white-on-black in the olden days.

    That said, I don't understand the obsession with dark mode. Like, the vast majority of texts I have encountered in my life, books, papers, letters, etc., are black on white. So why dark mode? People tell me it's different on screens because of reasons. I really think it is more of a fad, like, if you wanna be cool, use dark mode. Unfortunately, I will never be cool because of my poor eyes.

    I am lucky, however, in the sense that with a "reader view" built into my browser, I can quite easily turn dark-mode websites into something I can actually read. I think it would be fair if that worked the other way around too, for people who prefer dark mode. But wait, I never actually checked, but perhaps you can configure the colors of "reader view"?!

    • frereubu a few seconds ago

      I'm the same. I have really strong after-images when I've been reading in dark mode for quite a short time, and they get in the way of the reading itself because I can see them shift as my eyes move down each line.

      The other problem I have with dark mode is if you're working with dark windows, then go to open a website, the vast majority of which are light mode, you get blinded.

    • handoflixue 4 minutes ago

      Mostly I think people care about consistency - if you mostly use dark mode, then light mode is a sudden blinding flash. If you mostly use light mode, dark mode requires you to squint as everything suddenly goes dim.

      Dark mode is also very nice for those working in low-light environments, so that your dark vision isn't ruined when you need to get up and attend to other errands. With the rise in Work From Home and flexible schedules, I suspect there's a lot of hackers writing code at 2 AM in very badly lit rooms.

    • urgentcoconut 6 minutes ago

      You aren’t alone in this. I like the look of dark mode and keep it on my phones as they have OLED panels. But when I need to get work done … ie on my computers, there’s no room for light mode

      I just can’t distinguish text in dark mode. It’s likely got something to do my eyesight since I’m near sighted.

  • WithinReason an hour ago

    You can put this in a bookmark and click it on any site to swap light/dark:

        javascript:(function(){const id='_dark_mode_bm';const el=document.getElementById(id);if(el){el.remove();}else{const s=document.createElement('style');s.id=id;s.textContent='html{filter:invert(1) hue-rotate(180deg)!important;background:#fff!important;}img,video,canvas,picture,svg{filter:invert(1)%20hue-rotate(180deg)!important;}';document.head.appendChild(s);}})();
    
    It does slow down page rendering on some browsers though
  • alex8889 an hour ago

    Edge and Chrome have a flag that does roughly this for every site, auto dark mode for web contents. I think it tries to leave photos alone instead of inverting everything, which helps on heavier pages.

    • LoganDark an hour ago

      Safari will have this too soon, as of version 26.3 (still in beta currently)

  • etatester an hour ago

    The fact that HN devs still refuse to add 3 lines of CSS makes me think nobody actually uses the website nor cares.

    • handoflixue 3 minutes ago

      In fairness, the site is called Hacker News. If you can't hack it (as in, add the feature yourself), why would they want to cater to you? There's multiple numerous helpful responses explaining how to DIY in this thread if it actually bothers you.