Pratham Shah

Force Dark Mode

Privacy-first Chrome extension that darkens websites, PDFs and local documents. 2,500+ weekly users.

A Manifest V3 extension, published as Force Dark Mode - ThemeSwitcher under my PshahLab brand, that picks a dark-mode strategy per page, renders PDFs offline in a dark canvas viewer, and syncs per-site preferences. Documents never leave the machine; the only data sent to me is an opt-in usage report and broken-site reports the user confirms one by one.

Chrome extension, Jan 2026 – present

The Force Dark Mode homepage with a light-to-dark split across the headline 'Dark mode for every page you read'.

What problem does Force Dark Mode solve?

Global colour inversion turns photos into negatives, double-inverts sites that are already dark, and flashes white before the theme applies. PDFs and local files usually aren’t covered at all.

Why it was worth building

A small, useful product used by real people, with the constraints that come with that: performance on every page, a store review process, privacy obligations and releases.

How does Force Dark Mode work?

Per-page theming
  1. Navigationcontent script at document_start
  2. Bind CSS variablesbefore first paint, no white flash
  3. Read passluminance + media density, no DOM writes
  4. Choose engineAuto / CSS override / invert / skip
  5. Batched writeone requestAnimationFrame
  6. ObserveMutationObserver for SPA updates

Technical decisions

Separate read and write passes

Measuring the page and applying styles in different animation frames avoids layout thrashing, which keeps scrolling smooth.

Detect native dark mode and leave it alone

Sites like YouTube and GitHub are already dark. The Auto engine skips them instead of double-inverting.

Offline viewer, opt-in reporting

Only the storage, activeTab, contextMenus and sidePanel permissions and a document_start content script, with no host permissions. PDF.js is bundled, so no document leaves the machine. The usage report is off by default and a broken-site report goes only when the user confirms it; both send a fixed set of validated fields, never page addresses or content.

Challenges

Canvas-rendered apps

Editors like Google Docs draw content on canvas, which no CSS approach can recolor. This is documented as a known limitation rather than hacked around.

What I built

  • Auto, CSS-override and invert engines, plus an offline dark document viewer for PDF, Markdown, TXT, RTF, DOCX, PPTX, CSV and XLSX files, with saturation-aware pixel conversion for PDFs.
  • Version 2.1.0 moved the UI into the browser side panel. Version 2.0.0 added eight built-in themes, a theme editor with a contrast guard, site packs for 20 popular sites and sanitised per-site custom CSS.
  • Settings export, import and erase with schema validation, and a privacy/security test suite (prototype-pollution guards, no innerHTML, CSP checks).
  • Documentation set covering privacy, threat model, incident response and a compliance matrix, plus a public marketing site.
  • Opt-in usage report (a random install ID, the day, version, which engines were used that day and how many sites, never which ones); turning it off deletes the server records. Broken-site reports are confirmed each time and send only the domain, engine, theme and version, with no ID. Both go to endpoints on this site that reject any other fields, and are purged after 13 months.

Results

  • 2,500+ weekly users on the Chrome Web Store.
  • Semantic-versioned releases with a changelog.

Adoption

2,500+ weekly users and 6,000+ in total on the Chrome Web Store (developer dashboard, 28 Oct 2026). The install trend is tracked independently by Chrome-Stats.

Chrome-Stats trendsView profile

The chart is hosted by Chrome-Stats. Loading it contacts their server.

Takeaways

  • Shipping to real users means writing the privacy policy, handling store review and treating edge cases as bugs, not trivia.

What I'd do next

  • Translated store listing and extension interface.