Menu

Building a Firefox dark mode extension: what actually works (and what doesn't)
πŸ“°

Building a Firefox dark mode extension: what actually works (and what doesn't)

DEV Community: cssΒ·Weather Clock DashΒ·14 days ago
#N47B56TO
#devtocss#devto#dev#dark#color
Reading 0:00
15s threshold

Most dark mode extensions intercept every page load with a content script that injects CSS. Some use JavaScript-based theme detection, some use prefers-color-scheme media queries, some use their own inversion filters.

I wanted to understand why dark mode on the web is still such a mess, so I built NightOwl β€” a Firefox extension that applies dark mode without mutation observers and without touching pages it shouldn't.

The problem with most dark mode approaches

CSS inversion ( filter: invert(1) hue-rotate(180deg) ) is fast but breaks images, videos, and color-coded content. Media turns into negatives.

JavaScript-based theming can be more precise but adds latency to every page load. You see a white flash before the dark style applies.

Browser-level dark mode ( about:config > layout.css.prefers-color-scheme.content-override ) is the cleanest solution but only works for pages that actually support prefers-color-scheme .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.