Pratham Shah

Force Dark Mode

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

Chrome extension, Jan 2026 – present

Chrome Web Store listing for Force Dark Mode, showing 1,000 users and a screenshot of Wikipedia.

A Manifest V3 extension, published as Force Dark Mode - ThemeSwitcher under my Chameleon Labs brand, that picks a dark-mode strategy per page, renders PDFs offline in a dark canvas viewer, and syncs per-site preferences. No telemetry and no network requests.

Problem

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.

Architecture

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 and minimal permissions

Only storage, activeTab and a document_start content script. PDF.js is bundled, so no document leaves the machine.

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 a PDF, Markdown, TXT and RTF viewer with saturation-aware pixel conversion.
  • v1.6.1 added data 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.

Results

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

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

  • DOCX and PPTX preview in the offline viewer (spec and plan dated 2026-09-26 in the repository).