---
title: "Dark mode was never on our roadmap. Here’s how it got built."
description: "Medium shipped dark mode for its reader experience with essentially one engineer working between other projects, guided by three guardrails: keep it safe, keep it small, keep it concrete."
url: "https://swe.quest/articles/dark-mode-was-never-on-our-roadmap-here-s-how-it-got-built-65fcd1920934b974"
canonical: "https://medium.engineering/dark-mode-was-never-on-our-roadmap-heres-how-it-got-built-b8e0a54c1d12"
source: "Medium Engineering"
published: "2026-10-22"
difficulty: "medium"
kind: "Case study"
reading_minutes: 17
tags: ["css","frontend","design-systems","cdn-edge","ai-coding"]
---

# Dark mode was never on our roadmap. Here’s how it got built.

A post on [Medium Engineering](https://swe.quest/sources/medium-eng.md), published 2026-10-22, 17 min read, Case study. Original: [https://medium.engineering/dark-mode-was-never-on-our-roadmap-heres-how-it-got-built-b8e0a54c1d12](https://medium.engineering/dark-mode-was-never-on-our-roadmap-heres-how-it-got-built-b8e0a54c1d12)

## Summary

Medium shipped dark mode for its reader experience with essentially one engineer working between other projects, guided by three guardrails: keep it safe, keep it small, keep it concrete. Work-in-progress CSS sat behind a Statsig feature flag that temporarily split the Cloudflare Workers edge cache. The flash of incorrect theme was avoided by converting hard-coded hex color tokens to CSS variables using light-dark() and color-scheme, which lets the browser pick the theme before first paint without caching a light and a dark copy of every page. Claude audited the codebase for hard-coded and legacy colors and turned the findings into small Linear tickets, while manual QA and designers handled the judgment calls.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [CSS](https://swe.quest/tags/css.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Design systems](https://swe.quest/tags/design-systems.md) (Web & mobile)
- [CDN & edge](https://swe.quest/tags/cdn-edge.md) (Infrastructure)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)

## Prerequisites

- CSS custom properties ([easy posts on CSS](https://swe.quest/tags/css.md?difficulty=easy))
- edge caching ([easy posts on CDN & edge](https://swe.quest/tags/cdn-edge.md?difficulty=easy))
- feature flags ([easy posts on Deployment](https://swe.quest/tags/deployment.md?difficulty=easy))
- design tokens

## Keywords

light-dark(), color-scheme, Cloudflare Workers, Statsig, Claude, Medium, dark mode

## Related posts

- [Illuminating dark mode](https://swe.quest/articles/illuminating-dark-mode-f998d746316f5fd8.md): Figma · 2022-07-21 · Medium · 15 min read · Design systems, CSS, Frontend, Refactoring & migrations, Accessibility
  Figma built dark mode by replacing roughly 5,100 build-time PostCSS color variables with runtime CSS custom properties based on a semantic token schema (Type | UI Element | Color role | Prominence | Interaction), so new themes only require reassigning token values.
- [The New York Times Games’ Path to Dark Mode](https://swe.quest/articles/the-new-york-times-games-path-to-dark-mode-4c848ca761eed7c4.md): NYT Open · 2025-09-25 · Easy · 8 min read · Design systems, Frontend, React, CSS, Product engineering
  Shipping Dark Mode for New York Times Games turned into paying down years of design debt, because eight games each had their own hex colors, fonts and component styles.
- [Introducing Adaptive Dark Mode](https://swe.quest/articles/introducing-adaptive-dark-mode-b5085c9f9c7b77a6.md): WebKit · 2026-11-03 · Medium · 5 min read · Browsers, CSS, Accessibility, Privacy
  Safari 27.3 beta adds Adaptive Dark Mode, which automatically darkens light websites that don't declare dark mode support via color-scheme.
- [Unlocking inclusive design: how Primer’s color system is making GitHub.com more inclusive](https://swe.quest/articles/unlocking-inclusive-design-how-primer-s-color-system-is-making-github-com-more-438d95888d234cb3.md): GitHub Engineering · 2023-05-11 · Medium · 6 min read · Accessibility, Design systems, CI/CD, Frontend
  GitHub's Primer design system fixed hundreds of color contrast violations across light and dark modes and all themes by changing its foundational color tokens (Primer Primitives) rather than individual components.
- [How The New York Times Games Team Delivered Accessible, Cross-Platform Dark Mode](https://swe.quest/articles/how-the-new-york-times-games-team-delivered-accessible-cross-platform-dark-mode-9c38944ca6dbae2c.md): NYT Open · 2026-04-16 · Medium · 7 min read · Mobile, Design systems, Accessibility, Swift
  The New York Times Games app shipped dark mode across Android, iOS and hybrid webviews by moving from hard-coded colors to semantic design tokens (e.g. "Background Primary" became "$bg-page") through a legacy-to-new color mapping.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
