TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Hacker News dark mode with uBlockOrigin / AdGuard cosmetic filters

3 pointsby xvelloover 2 years ago
Cosmetic filters are usually used to hide elements, but they can also be used to add CSS styles to the matching elements. Inspired by https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=32719488, here are two rules to implement a dark mode on HN:<p><pre><code> news.ycombinator.com##html:style(filter:invert(100%) hue-rotate(180deg)) news.ycombinator.com##body:style(background: white) </code></pre> The first rule inverts all colors (white to black, orange to blue), then returns blues to oranges with a hue rotation. The second rule adds a black border in the margins around the main table (white + invert(100%) = black).<p>To use these rules:<p>- uBlockOrigin: open the preferences (right-click on the toolbar icon and cog icon, or via the extension list), and copy these in the &quot;My filters&quot; tab<p>- AdGuard: open the settings and copy these in the &quot;User rules&quot; section

1 comment

xvelloover 2 years ago
For the CSS nerds out here, cross-browser compatibility dictated the split in two rules. The following rule:<p><pre><code> news.ycombinator.com##html:style(filter:invert(100%) hue-rotate(180deg); background: white) </code></pre> works great on Firefox, but leaves the borders white in Chrome. Chrome applies the background directive AFTER the color inversion filter, while Firefox applies it BEFORE. On Chrome, you should use instead:<p><pre><code> news.ycombinator.com##html:style(filter:invert(100%) hue-rotate(180deg); background: black)</code></pre>