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

Earlier comments
Zekio2 replies#
If you use Firefox you can use the addon Dark Reader, so you can get dark mode for every site if you want at night
_bxg11 reply#
Most of those extensions work by just inverting the colors of the entire page. Pretty unideal, compared to an intelligently-written dark theme.
Zekio1 reply#
Dark reader by default uses a different approach than that, but it can fallback to inverting colors IIRC
_bxg1#
Extensions are also a huge security liability; I install very few of them these days
fao_1 reply#
Dark Reader adds a good 5 seconds of lag to interacting with the web (including: website loading, website interaction, tab switching) for me.
accelbred1 reply#
That's why I use "Dark Background and Light Text". Color schemes are not as good as Dark Reader, but it doesn't noticeably affect performance.

Continue this thread — 1 reply

badrchoubai1 reply#
This is code for an extension I run locally.

const getAttributes = () => {

  let head = document.head || document.getElementsByTagName("head")[0];

  return {
    head,
  };
};

const changeStyles = (targetElement) => {
style = document.createElement("style");

  // set style.innerHTML to darker colors, append to head
  style.type = "text/css";
  style.innerHTML = `
    body, #hnmain { background: #272822; }
    a.storylink, a.morelink, span.commtext { color: #fff; }
    a.storylink:visited { color: #444444; }
  `;
  targetElement.appendChild(style);
};

(function main() { const { ...attributes } = getAttributes(); changeStyles(attributes.head); })();

fermienrico2 replies#
NOOOO! Why not a check box in the profile page? There is already a place for changing the colors. Can we please not add any javascript? The server remembers my topbar color. It can remember a boolean flag too.
jypepin#
I think he shared this in case others want to use this to update their hn theme locally, not for hn to implement this...
badrchoubai#
Actually I wonder if I could implement that with the extension, that would be nice.
green-bottle#
The majority of Desktop browsers support extensions that provide support for dark mode. On mobile I know Android Chrome (via chrome://flags) and Firefox (via extensions) support dark mode. Don't know about Safari and other mobile browsers but I feel that overall there are plenty of options for dark mode on HN without a separate site specific implementation.

I also have noticed that I never use the site specific Dark mode implementations as it is a lot more convenient to globally enable dark mode (at night) rather than playing around with toggles for every website that supports it.

mrep#
For desktop, I use the refined hacker news extension (github: [0], show HN for it: [1]) which allows you to set custom CSS. It has a dark mode setting but I prefer the following CSS which makes the entire background black and the text white (Screenshot: https://imgur.com/a/2lcy1Ga):

  :root,
  html {
     background-color: white;
     filter: invert(100%);
  }

  * {
     background-color: inherit;
  }
Another great thing about the extension is when you go back to the same thread, it gives a little highlight to new comments that you haven't seen before so you can quickly find them. Only downside is that that doesn't work for comments after the first page.

[0]: https://github.com/plibither8/refined-hacker-news
[1]: https://news.ycombinator.com/item?id=20173974

Load more comments