Back to browse
GitHub Repository

Hacker News dark mode bookmarklet

1 starsJavaScript

Hacker News Dark Mode Bookmarklet

by gorgonian·May 9, 2026·1 point·0 comments

AI Analysis

●●SolidCozyNiche Gem

Same-origin iframe trick keeps dark mode alive across HN navigations without extensions.

Strengths
  • Iframe navigation survival trick is genuinely clever for bookmarklet constraints
  • Clean esbuild pipeline with CSS injection and minification
  • Works without extensions, apps, or proxies on iOS
Weaknesses
  • HN dark mode already solved by many extensions and userstyles
  • iOS-only focus limits broader adoption; iframe approach adds complexity
Category
Target Audience

iOS Safari users who browse Hacker News

Similar To

Dark Reader · Stylus · Various HN dark mode userscripts

Post Description

I love HN, but I also love dark mode. I wanted dark mode HN on my iPhone without any extension/third party app/proxy fuss, so I made this bookmarklet. One tap on news.ycombinator.com and dark mode sticks across page navigations. I'm sure this has been done before, but I couldn't find a solution that satisfied me. Thought I'd share in case anyone is in the same boat.

How it works: bookmarklets normally die on the first navigation. This one replaces the page with a same-origin iframe pointing at HN, then re-injects CSS on every iframe load. Since the iframe is same-origin, everything (cookies etc) should work normally. I've tested this in Chromium/Linux and Safari/iOS.

Similar Projects