Skip to content

This website is still under development, so some information may not be accurate yet.Under development · details may not be accurate

Umbra

A Chrome and Firefox extension that darkens the web without breaking it: it switches on a site's own dark theme when there is one, and otherwise remaps the site's real colors perceptually.

Umbra: Natural dark mode for every website. Wikipedia in dark mode in a browser window, with the Umbra popup.

The idea

Most dark mode extensions lay a filter over the page or paint every site with the same palette, so photos look wrong, logos disappear and sites lose their design. Umbra starts from a different idea: the most natural dark theme is the one the site's own designer made. If a site has a dark theme, Umbra switches it on. If it's already dark, Umbra steps aside. Only when neither is true does it build a theme of its own, by remapping the site's real colors rather than covering them.

Implementation

  • A Manifest V3 extension for Chrome and Firefox, built with WXT and TypeScript, with a popup written in plain TypeScript and CSS.
  • For each page it checks your rules first, then samples the rendered page to see whether it's already dark, then tries the site's own theme: its Appearance switch, a prefers-color-scheme override for themes picked in JavaScript, its dark media queries or its .dark and data-theme classes.
  • Adaptive mode remaps every color in OKLCH, with separate curves for backgrounds, text, borders, shadows and accents, and nudges text until it meets WCAG AA contrast.
  • CSS variables get a twin for each role they're used in, so --white used as button text stays white while the same variable used as a card background turns dark.
  • Every stylesheet gets an override sheet inserted right after it, with its @media, @supports, @container, @layer and nesting intact. Cross-origin sheets, CSS-in-JS, shadow DOM, inline styles and legacy color attributes are covered too.
  • Dark logos on transparent backgrounds are inverted and light textures darkened, while photos and multicolor artwork are left alone.
  • A dark shell is injected at document_start, so pages never flash white while they load.

Challenges

  • Telling whether a page is already dark from what is actually rendered, through shadow roots and with Umbra's own styles switched off.
  • Turning on a site's own dark theme the way picking "Dark" in its menu would, and keeping it only when the result really has dark backgrounds and light text.
  • Keeping the cascade faithful, so every override wins exactly where the original rule won, including inside layers, container queries and nested rules.
  • Colors whose role depends on where they're used: the same variable can be a background in one place and text in another.

Result

Version 0.2.0 understands the whole of CSS Color 4 and themes sites through their own dark themes or its adaptive engine, with per-site modes, exclusions, tuning, custom CSS and a schedule, all from the popup. It is covered by Vitest unit tests and Playwright end-to-end tests and builds for Chrome and Firefox; it isn't on the browser stores yet.

How It Decides

For every page, in this order:

  • Your rules first: global switch, schedule, and per-site and per-page settings
  • Already dark? Umbra removes itself and checks again after in-app navigation
  • The site ships a dark theme? Umbra switches it on and keeps it only if the page really turns dark
  • Otherwise, adaptive mode remaps the site's own colors

Features

  • Per-site and per-page exclusions with wildcards, or a list of the only sites to darken
  • Per-site mode: automatic, always Umbra's theme, or an invert filter for canvas apps such as Google Docs
  • Custom CSS, brightness, contrast and image dimming for each site
  • A schedule: always, following the system theme, or custom hours
  • Alt+Shift+D toggles the current site