← Wed, Dec 2 digest

Minimal dark mode styles for Hacker News

read article ↗ hn thread ↗

A simple CSS snippet using color inversion and hue rotation provides a minimalist dark mode for Hacker News without heavy extensions.

summary is enough The core CSS trick is useful, but readers can grab the code snippet in seconds without reading the full text.

summary

The post details a lightweight CSS snippet utilizing color inversion and hue rotation to turn Hacker News dark via custom style injectors. Because Hacker News lacks a native dark mode, users typically rely on heavy browser extensions, separate web clients, or userscripts. This simple trick bypasses those workarounds while keeping code minimal. Commenters expand on the approach with alternative uBlock Origin filters, native browser settings, and third-party clients.

key points

  1. Applying invert(1) and hue-rotate(180deg) inside a prefers-color-scheme media query inverts light and dark values while keeping original hues intact.
  2. Commenters offer alternative lightweight styling methods using uBlock Origin custom filters rather than dedicated styling extensions.
  3. Discussion splits between those wanting a native HN dark mode and purists who value the site's ascetic simplicity and DIY ethos.

who should read it

Frontend developers and Hacker News power users looking for lightweight ways to theme the site.

discussion positive

consensus

Commenters generally agree that a dark mode is desirable but debate the best workaround, sharing snippets for uBlock Origin, Stylus, and browser flags.

pushback

A minority defends HN's refusal to add a dark mode, arguing that the site's ascetic design prevents bloat and encourages user customization.

best comment by ralgozino ↗

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)

! …

Provides a practical uBlock Origin filter snippet that handles font scaling and system-matching themes without requiring separate extension installations.

Generated by an LLM from the article and thread. Check the sources before relying on it.